Accessing To A Struct With A Given Pointer
We have a struct defined as :
typedef struct tagWINDOWPOS { /* wp */[INDENT] HWND hwnd;
HWND hwndInsertAfter;
int x;
int y;
int cx;
int cy;
UINT flags;[/INDENT]} WINDOWPOS;
Then we are sent a message...WM_WINDOWPOSCHANGING
[INDENT] WPARAM wParam
LPARAM lParam;[/INDENT]
Parameters
wParam[INDENT]This parameter is not used.[/INDENT]lParam[INDENT]Pointer to a WINDOWPOS structure that contains information about the window's new size and position.[/INDENT]
And this is the code which gets the messagecase WM_WINDOWPOSCHANGING:[INDENT] WINDOWPOS * pWinPos;
pWinPos = lParam;
break;[/INDENT]lParam contains the address of the struct. Here we want to access to the struct.
But there is a problem with the code. pWinPos is a constant pointer, so we can't simply assign an address to it.
So, finally, here is my question...
How can I access to the WINDOWPOS struct whose address is given by lParam
AhmedHan
Junior Poster in Training
71 posts since Apr 2005
Reputation Points: 13
Solved Threads: 1
IsWINDOWPOS wp;
WINDOWPOS * pwp;
pwp = ℘convenient?
Then we can access to the sub-fields this way :pwp->x
pwp->uflags
etc...
AhmedHan
Junior Poster in Training
71 posts since Apr 2005
Reputation Points: 13
Solved Threads: 1
Thanks.
Type conversion works well.
AhmedHan
Junior Poster in Training
71 posts since Apr 2005
Reputation Points: 13
Solved Threads: 1