Link to home
Start Free TrialLog in
Avatar of kingpie
kingpie

asked on

RegisterWindowMessage in MFC

Hi,
I am using functions from a 3d mouse (Pegasus FreeD)DLL, and the example code (which des work) is written in ordinary c++ windows
format (WndProc, WinMain etc).  I am trying to convert it to work in an MFC environment.
The application opens the DLL with the app window handle, to which messages form the dll are sent when
new information is available from the input device.
The .h file for the dll has the following definition:

#define FREEDMessageIdName "3D_FREED_New_Info"
FREED_info FREED_Info;         // structure containing data for the 3d input device
static WORD WM_FREED_NewInfo=0;

The application code, after opening the dll, calls RegisterWindowMessage, in the WM_CREATE section
of the windows message loop:
WM_FREED_NewInfo = RegisterWindowMessage(FREEDMessageIdName);
..

Then each time in the message loop, a WM_FREED_NewInfo message is detected(sent by the dll)
whenever there is new information available.
Fine.
Putting it in MFC, how do I get the message map to work? It doesn't seem to at the moment.
In the ..View constructor, I called the RegisterWindowMessage as above, and in the message map:
ON_MESSAGE(WM_FREED_NewInfo, OnNewInfo)
but it never seems to pick up those messages (if they are in the queue at all).

Thanks for any help
KingPie

ASKER CERTIFIED SOLUTION
Avatar of agopal
agopal

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kingpie
kingpie

ASKER

Great stuff!