Modeless Message Box
Due to the fact that some WinSock APIs block until data
is recieved, it is useful to have a message box that we can create and
destroy in the program. This is used when the an application is blocking
for data. We can show them a message while the application is blocking,
and then automatically kill the message box when data is recieved.
I have derived a simple modeless dialog class to accomplish this.
Source Files
DGModeless.cpp
DGModeless.h
The class is called CDGModelessMessage and is contained
in the files DGModeless.cpp and DGModeless.H. These
files are very straight forward. Very simply, there is a dialog template
for the message box included in each project's resources that uses CDGModelessMessage.
The program can create the message box and launch it with two simple calls.
This should be done immediately before a call to a blocking operation.
Then the application can kill the message box when the blocking operation
is complete. Here is an example:
CDGModelessMessage dg("Place the message here.", "Place
the title of the message box here.");
dg.Show();
Call to blocking operation...
dg.Kill();
That's all there is to it. Note that the first parameter to the CDGModelessMessage
constructor is the actual message you want to show. The second parameter
is the title of the message box. The second parameter is optional.
Back to Winsock Tutorials Main Page