
These 2 classes provides a clean C++ interface to the little known but quite
powerful Win32 IPC mechanism called mailslots. They are very similar to the more common
"Named pipe" IPC mechanism. Unlike named pipes, mailslots use datagrams. A
datagram is a small packet of information that the network sends along the wire. Like a
radio or television broadcast, a datagram offers no confirmation of receipt; there is no
way to guarantee that a datagram has been received.
Mailslots can broadcast messages within a domain. If several processes in a
domain each create a mailslot using the same name, every message that is
addressed to that mailslot and sent to the domain is received by the
participating processes. Because one process can control both a server and
client mailslot handle, applications can easily implement
a simple message-passing facility within a domain.
Another advantage that mailslots have over named pipes is
that the server mailslot (the mailslot which can read) can be created on Windows
9x. This is unlike named pipes which can only be created server side on Windows
NT, 2000, XP, 2003, Vista & 2008.
The enclosed zip file contains
the source code for the 2 classes and also includes a VC 2005 solution to build a
demonstration program called WinNotify. People who have used the MS WinPopup utility will notice the "Striking similarity" between it and
the demonstration program as shown below:

Copyright
- You are allowed to include the source code in
any product (commercial, shareware, freeware or otherwise) when your product
is released in binary form.
- You are allowed to modify the source code in
any way you want except you cannot modify the copyright details at the top
of each module.
- If you want to distribute source code with
your application, then you are only allowed to distribute versions released
by the author. This is to maintain a single distribution point for the
source code.
Updates
V1.1 (26 July 1998)
- Provision of Unicode build configurations
- Fixed a bug in CClientMailslot destructor
- CServerMailslot::Close() & CClientMailslot::Close() now work
correctly when the mailslot is already closed
- Fixed a level 4 warning in the CWinNotifyDoc in the demo program.
- Complete documentation for the classes is now provided in the form of
a HTML file
- Changed 2 functions which used a pointer parameter to now use a C++
reference instead.
V1.11 (10 August 1998)
- Fixed a bug in the Close function of both classes where the mailslot
handle was not being set back to INVALID_HANDLE_VALUE.
11 August 1998
- Inclusion of a VC 5 make file.
- Tidy up of the resources the program uses plus their names.
V1.11 (26 July 2003)
- Updated copyright details.
- Fixed issue in CClientMailslot::Open which was causing
it to only allow one instance of the mailslot to be opened. Thanks to GdP
Software for reporting this problem.
V1.12 (22 December 2006)
- Updated copyright details
- Updated the documentation to use the same style as the web site
- Optimized CServerMailslot constructor code
- Addition of a CMAILSLOT_EXT_CLASS preprocessor macro to allow the
classes to be more easily added to an extension dll
- Reviewed all TRACE statements for correctness
- Optimized CClientMailslot constructor code
- Updated the code to clean compile on VC 2005
- Code now uses newer C++ style casts instead of C style casts.
- Changed the default size of the formview window in the sample ap to
avoid scroll bars using default fonts.
V1.13 (23 December 2006)
- Code now uses CString instead of raw TCHAR buffers in various functions
- Classes now do not derive from CObject as it was not really required
V1.14 (8 September 2007)
- Updated copyright details.
- Minor code tidy up.
V1.15 (7 September 2008)
- Updated copyright details.
- Code now compiles cleanly using Code Analysis (/analyze)
- Updated code to compile correctly using _ATL_CSTRING_EXPLICIT_CONSTRUCTORS
define
- Updated sample app to clean compile on VC 2008
- The code has now been updated to support VC 2005 or later only.
- Removed VC 6 style AppWizard comments from the code.
- Updated the sample app to improve on the error reporting.