LOCAL lnLen, lcFrom, lcMsgName, lcUser, lcMsg * Convert all strings to UNICODE lcUser = strconv( StrConv(pcUser,1), 5) lcMsg = strconv( StrConv(pcMessage,1), 5) lcFrom = strconv( Strconv(Sys(0),1), 5) lnLen = len(pcMessage)*2+2 * Revised March 26, 2004. * For some reason, specifying the From name sometimes * causes the send to not go through. * res=NetMessageBufferSend( 0, lcUser, lcFrom, lcMsg, lnLen ) res=NetMessageBufferSend( 0, lcUser, 0, lcMsg, lnLen ) RETURN res
Or, you could run the NET.EXE command and let it take care of the details for you.
RUN net send UserName Message Text
The disadvantages of doing it this way are: o The RUN command starts a command shell first which usually is visible as a black-background window that flashes on the screen for a moment. Whether it's visible or can be difficult to control (it's controlled by FOXRUN.PIF so you have to modify that file appropriately, and distribute it with your application). o RUN is significantly slower than DLL function calls. o The RUN command requires the user to have execute rights on COMMAND.COM or CMD.EXE, which, in a locked down computer environment, are probably taken away.