Determining Handle and WM_CopyData Messages...
Posted on 2006-06-11
This is really a two part question...
I am writing an app that interfaces with a piece of hardware through a DLL written by the manufacturer. I have no problem with the GUI or loading the DLL, etc... What I'm having issues with is the concept of communicating using WM_CopyData messages. I'm learning as fast as I can, but my deadline doesn't allow this learning curve :) Oh, I'm using VC++ Express if that makes any difference. I had a FULLY FUNCTIONAL example written in VC++ 2003, but that is another story why I'm not using that...
First question... One of the parameters the manufacturer's function is asking for is the "window handle that will receive the WM_CopyData messages." How in the world do I determine that? I'm assuming I need the handle that calls the WndProc function in my app, but don't know how to get that handle.
Secondly... This whole WM_CopyData business; is the WndProc function established by default as the message handler without any intervention by me? I have created the function with knowledge I picked up around the net and I believe it to be right or close enough... The function is as follows:
protected: void WndProc(Message* m)
toolStripStatusLabel1->Text = "Processing incoming message.../n";
if (m->Msg == WM_COPYDATA)
COPYDATASTRUCT* CopyData = reinterpret_cast <COPYDATASTRUCT*> (m->LParam.ToPointer());
int DataType = CopyData->dwData;
int DataSize = CopyData->cbData;
switch (DataType) // determine type of message from DLL
What I am also curious about is why do I never see the "Processing Incoming Message..." that I have being displayed on my status label? Also, the examples I'm working on show the "else" argument as __super::WndProc(m); but that will not compile. What in the world is a __super? When I switch it to Form1 it compiles nicely.
Your help would be appreciated. I'm offering 500 points here because I'm dumb and you'll have to deal with me and also I've searched all over for these answers and can't find them.