OD
asked on
Mailbox Events
How can I receive "notifications"/events when information is written into a mailslot?
I would thus like to do something like
WaitForSingleObject(SlotWr iteEvent, INFINITE) or something equivalent, instead of polling the mailslot
I would thus like to do something like
WaitForSingleObject(SlotWr
When you create the mailslot, specify MAILSLOT_WAIT_FOREVER for the lReadTimeout parameter.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
PoohBear,
Your answer does make sense to me and I think I will probably accept the answer (I can not test if for another week or so). Just a general question before I accept, can I "peek" into the mailslot, thus retrieve a message without removing it from the slot? (Especially for variable length messages, so that I can check a header with the message length)
Your answer does make sense to me and I think I will probably accept the answer (I can not test if for another week or so). Just a general question before I accept, can I "peek" into the mailslot, thus retrieve a message without removing it from the slot? (Especially for variable length messages, so that I can check a header with the message length)
You cannot read from a mailslot without removing the data. But you can retrieve the length of the next message using GetMailslotInfo.
// You must initilize hMailslot to the value returned by CreateMailslot
DWORD dwSizeOfNextMessage;
GetMailslotInfo(hMailslot, NULL, dwSizeOfNextMessage, NULL, NULL);
// You must initilize hMailslot to the value returned by CreateMailslot
DWORD dwSizeOfNextMessage;
GetMailslotInfo(hMailslot,