Click to See Complete Forum and Search --> : Sending message like Net Send command


Christophe_G
August 4th, 1999, 02:40 AM
Hi,
How can I read message (using code) arriving to a computer from another computer using the Net Send command.
I only know it uses mailslot, but what's its name ?

August 4th, 1999, 02:03 PM
USES_CONVERSION;

CString sMessage;
sMessage.Format("This is a test message");

CString sMsgName = _T("EVERYONE");

LPCWSTR pszMessage = A2CW(sMessage);

DWORD dwLen = wcslen(pszMessage) * sizeof(WCHAR);

NET_API_STATUS nStatus;

nStatus = NetMessageNameAdd(NULL, A2CW(sMsgName));

nStatus = NetMessageBufferSend(NULL, A2CW(sMsgName), NULL, (LPBYTE)pszMessage, dwLen);

NetMessageNameDel(NULL, A2CW(sMsgName));

Christophe_G
August 5th, 1999, 02:31 AM
And for receiving arriving messages ?

Jim Bassett
February 15th, 2000, 08:36 AM
I have tried this code and it works on my workstation but I am not able to send a message to another workstation.

I am trying to make use of the NetMessageNameAdd and NetMessageBufferSend commands. I want to specific want machine the message will be seen on but I don't see in the argument list how to specify that, how does one do that. The first argument in both functions is the server name and the notes state the string must start with \\ but when I place the name of my workstation there with the \\ it doesn't work. If I place the name of my workstation without the \\ it works...I don't understand.

Thanks