simple_message_pump User’s Guide

Related Documents



This implements a “message loop” as needed to drive the low-level Win32 windows management.

Threading Issues

The class does not have any instance data, and you will normally only call one function: pumpit. So there are no threading issues in the normal sence.

But the underlying Win32 functions are very thread-centric. The message pump only operates on windows created on the same thread. If you have multiple GUI threads, you will have a message pump on each one.

Housekeeping Issues

N/A. It is only an instance (as opposed to all static or being a namespace rather than a class) to provide for virtual functions.

How to Use

Customize the behavior by overriding any virtual functions in your derived class. You may create windows before starting the message pump, but they will not be serviced untill messaging starts, and you must create with the same thread. Instantiate this class, and call pumpit. It will not return until the program (or that auxilary GUI thread) is ready to terminate.

The most primitive example is found in message_tap_demo.cxx.

int __stdcall WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, char* lpCmdLine, int nCmdShow)
 if (!InitApplication(hInstance))  return (1);
 if (!InitInstance(hInstance, ratwin::window::SW_window(nCmdShow))) return (2);
    // The call to InitInstance created the application window
 tomahawk::simple_message_pump pump;
 int exitcode= pump.pumpit();
 return exitcode;