Although I'm not really sure what bencharluo is trying to say, This is how I usually do it.
1.) Assuning your not using some predefined data type (LPSTR, LPDWORD, etc...) you will have to define your own. You can do this by creating a new structure:
1 2 3 4 5 6
|
struct TESTSTRUCT{
TCHAR byte1;
TCHAR byte2;
DWORD dword1;
DWORD dword2;
};
|
2.) Not that we have defined our new data type, can pass it to a windows procedure by using
SendMessage()
(I will be use
#define WM_USERDEFINED_MSG WM_USER+1 for the message type)
1 2
|
TESTSTRUCT ts={'a','b',1337,31337};//construct the structure
SendMessage(YourTargetWindow, WM_USERDEFINED_MSG, (WPARAM)&ts, 0);
|
3.) Now that we have passed our variable as a reference, we have to intercept and interpret it at the other end.
This will be somewhere inside of
YourTargetWindow's window procedure function:
1 2 3 4 5 6
|
if(uMsg==WM_USERDEFINED_MSG){
TESTSTRUCT *ts=(TESTSTRUCT*)wParam;//oh pointers, how I love thee
TCHAR msgText[256]="";//empty text buffer
sprintf(msgText,"%c\n%c\n%d\n%d",ts->byte1,ts->byte2,ts->dword1,ts->dword1);
MessageBox(YourTargetWindow,msgText,"Here is the data that was passed",MB_OK);
}
|
I hope that this was helpful to you. Here is the MSDN Documentation for
SendMessage() that comes in handy a lot.
http://msdn.microsoft.com/en-us/library/ms644950(VS.85).aspx
Sigma