WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Network Related

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

NetMessageBufferSend UDF


#definefunction SendMessage(msgtext,sendFrom,sendTo)
srctype = 0 ;ANSI
targtype = 3 ;Unicode
codepage = 0 ;ANSI
handle = DllLoad(strcat(dirwindows(1),"NETAPI32.DLL"))

ToBuf=BinaryAlloc(StrLen(sendTo)*2+100)
BinaryPokeStr(ToBuf,0,sendTo)
BinaryConvert(ToBuf, srctype, targtype, codepage, 0)
FromBuf=BinaryAlloc(StrLen(sendFrom)*2+100)
BinaryPokeStr(FromBuf,0,sendFrom)
BinaryConvert(FromBuf, srctype, targtype, codepage, 0)
MsgBuf=BinaryAlloc(StrLen(msgtext)*2+100)
BinaryPokeStr(MsgBuf,0,msgtext)
BinaryConvert(MsgBuf, srctype, targtype, codepage, 0)

sent = dllcall(handle,long:"NetMessageBufferSend",lpnull,lpBinary:ToBuf,lpbinary:FromBuf,lpbinary:MsgBuf,long:strlen(msgtext)*2)

BinaryFree(ToBuf)
BinaryFree(FromBuf)
BinaryFree(MsgBuf)

return sent
;NetMessageBufferSend Lib "NETAPI32.DLL" (yServer As Any, yToName As Byte, yFromName As Any, yMsg As Byte, ByVal lSize As Long) As Long
#endfunction

Success = SendMessage("Hey there pretty mama!","Your home...","wwvxp528415")
Message ("Success",Success)
Exit




Article ID:   W16740
File Created: 2005:02:18:12:22:08
Last Updated: 2005:02:18:12:22:08