| | |
Accessing To A Struct With A Given Pointer
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
We have a struct defined as :
Then we are sent a message...
And this is the code which gets the message
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
•
•
•
•
typedef struct tagWINDOWPOS { /* wp */HWND hwnd;} WINDOWPOS;
HWND hwndInsertAfter;
int x;
int y;
int cx;
int cy;
UINT flags;
•
•
•
•
WM_WINDOWPOSCHANGING
WPARAM wParamParameters
LPARAM lParam;
wParamThis parameter is not used.lParamPointer to a WINDOWPOS structure that contains information about the window's new size and position.
•
•
•
•
case WM_WINDOWPOSCHANGING:WINDOWPOS * pWinPos;
pWinPos = lParam;
break;
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
•
•
Join Date: Jul 2005
Posts: 164
Reputation:
Solved Threads: 5
pWinPos is not constant. but you do need a cast. either an old c style or a reinterpret_cast<WINDOWPOS*>(lParam)
•
•
Join Date: Jul 2005
Posts: 164
Reputation:
Solved Threads: 5
i prefer....
WINDOWPOS* wp = (WINDOWPOS*)lParam;
WINDOWPOS* wp = (WINDOWPOS*)lParam;
![]() |
Similar Threads
- struct and member function pointer (C)
- A mistake about struct (C)
- hm.. wiered.. (C)
- struct error (!?) (C)
Other Threads in the C Forum
- Previous Thread: a short question
- Next Thread: Fibonacci number
| Thread Tools | Search this Thread |
#include adobe ansi array arrays asterisks binarysearch calculate centimeter changingto char convert copyimagefile cprogramme creafecopyofanytypeoffileinc database directory dynamic fflush file fork forloop framework getlasterror givemetehcodez grade graphics gtkgcurlcompiling hacking hardware highest histogram inches include incrementoperators input iso kernel km linked linkedlist linux linuxsegmentationfault list lists locate logical_drives looping loopinsideloop. lowest match matrix microsoft motherboard multi mysql number opendocumentformat opensource owf pattern pdf performance pointer posix probleminc process program programming radix recursion recv repetition research reversing scanf scheduling scripting segmentationfault sequential shape socket socketprograming stack standard string strings structures systemcall testautomation testing threads turboc unix user variable voidmain() wab windows.h windowsapi





