18. FAQ o Win API |
Q> How to send the message to the user (a-lja net send)
A>
Variant 1:
NET_API_STATUS x=NetMessageBufferSend (
LPTSTR servername,
LPTSTR msgname,
LPTSTR fromname,
LPTSTR buf,
DWORD buflen
);
Variant 2:
From: "Alexandr Shandra" <entryway@astral.ntu-kpi.kiev.ua>
It is possible through CreateFile/WriteFile, but in this case it is possible to send the message
Only to the computer or on local working group.
Here an example: (works both under NT and under 9x);
HANDLE hSlot = CreateFile ("\\\\computername \\mailslot \\messngr",
GENERIC_WRITE, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hSlot! = INVALID_HANDLE_VALUE)
{
char buf = "From\0\To\0Message\0";
uint cb = sizeof (buf);
WriteFile (hSlot, buf, cb, &cb, NULL);
CloseHandle (hSlot);
}
|
2000 (c) DM