get custom struct value from lparam?

So far for the whole night and looking it up which I can't seem to find anything on it, what I would like to do is get the struct value from lparam that I passed via sendmessage


so far I haven't had any luck on this and I know the fallowing will not work as I know there are some things wrong with it, but i'm just giving this as and example of what I want to do.

Say that i did something like:
typedef struct tag_FooStruct{
UINT valueOne;
int valuetwo;

}FooStruct;

FooStruct custom;
custom.valueOne=0;
custom.valueTwo=50;

SendMessage(hwnd,WM_CUSTOMMSG,0,(LPARAM)FooStruct);


Now lets say I have it in my windows procedure to handle this WM_CUSTOMMSG

I want to get the truct from lparam and pass it into my local struct to access like

windows procedure stuff above
....
FooStruct L_custom;
if(message==WM_CUSTOMMSG){

L_custom=(FooStruct)lParam;

}
....
rest of the procedure



and if this still doesn't make any sense then another example would be how would I get the RECT struct from lparam instead of using GetWindowRect ?

thank you all.

and this is my actual code that i'm trying to do:


I even tried using RtlCopyMemory with no luck :(.

Also i'm trying to only use windows 2000 apis as I want my program to work on windows 2000 and up

again thank everyone ^^
closed account (DSLq5Di1)
You were not too far off the mark, pass a pointer to the data as the LPARAM,

SendMessage(hwnd,WM_CUSTOMMSG,0,(LPARAM)&custom);

Reading it back in, FooStruct* custom = (FooStruct*)lParam; // custom->valueOne, custom->valuetwo

If you are passing data between processes, see:-
http://msdn.microsoft.com/en-us/library/windows/desktop/aa365574
Last edited on
Topic archived. No new replies allowed.