| | |
Accessing To A Struct With A Given Pointer
![]() |
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 |
adobe api array arrays binarysearch calculate char cm convert copyanyfile copypdffile cprogramme createcopyoffile createprocess() csyntax directory dynamic feet fflush file floatingpointvalidation fork forloop frequency getlasterror givemetehcodez global graphics gtkgcurlcompiling hacking hardware highest homework i/o inches incrementoperators intmain() iso kernel kilometer km linked linkedlist linux linuxsegmentationfault list locate logical_drives loopinsideloop. match matrix microsoft motherboard mqqueue mysql oddnumber odf open opendocumentformat opensource openwebfoundation owf pattern pdf performance pointer posix power probleminc program programming pyramidusingturboccodes read recursion recv recvblocked repetition research scanf scheduling segmentationfault send shape socketprograming socketprogramming stack standard strchr string suggestions systemcall test unix urboc user variable voidmain() wab win32api windows.h





