Say I have some windows method and a struct:
struct SomeStruct{ int foo; int bar; int baz; int bat; } SomeMethod(int a,int wParam, int lParam) { SomeStruct s; // get lParam into SomeStruct }
How to I get the lParam into a SomeStruct variable? I’m thinking that I need something like this (but feel free to point out my ignorance):
SomeMethod(int a, int wParam, int lParam) { SomeStruct *s; //declare struct variable s = lParam; //assign integer value as pointer to struct printf('the value of s.foo is %d', s.foo); //print result }
Yes, assuming that lParam ‘really’ contains a pointer to the struct, then you get at it by ‘casting’: