How to pass arguments from window to the windowProc function :
CREATESTRUCT str;
int*i = new int();
*i = 40;
str->lpCreateParams = i;
WindowProc()
{
switch(Msg)
{
int* j = (int*) ((LPCREATESTRUCT(lParam)) ->lpCreateParams)
}
}
Another one way is we can also attach the Window parameter at the time of
WNDcLASS registration.
wc.cbWndExtra = i;
we can get this value using GetWindowLong()
int* j = (int*) GetWindowLong(hWnd,GWL_USERDATA);
SetWindowLong() fn is also available
we can also use GetWindowLongPtr() or SetWindowLongPtr() for this purpose.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment