| | |
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
Views: 1774 | Replies: 4
| Thread Tools | Search this Thread |
Tag cloud for C
#include * append array arrays asterisks binarysearch calculate changingto char character cm command copyimagefile cprogramme creafecopyofanytypeoffileinc database directory dynamic execv feet fgets file fork forloop framework function functions givemetehcodez grade graphics gtkwinlinux hacking histogram homework include incrementoperators input intmain() iso kernel keyboard km lazy license linked linkedlist linux list lists locate logical_drives looping loopinsideloop. lowest matrix microsoft mqqueue mysql number oddnumber odf opensource overwrite owf pdf performance pointer pointers posix problem probleminc process program programming radix recursion recv recvblocked research reversing scanf scripting segmentationfault sequential socket spoonfeeding standard string student systemcall testing threads turboc unix user variable wab whythiscodecausesegmentationfault windowsapi





