Click here to Skip to main content
15,913,939 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralMutex, a simple question. Pin
devvvy30-Oct-02 18:15
devvvy30-Oct-02 18:15 
GeneralRe: Mutex, a simple question. Pin
Scott H. Settlemier30-Oct-02 18:50
Scott H. Settlemier30-Oct-02 18:50 
GeneralRe: Mutex, a simple question. Pin
devvvy30-Oct-02 19:30
devvvy30-Oct-02 19:30 
Generaldetecting server socket reset Pin
Anonymous30-Oct-02 16:53
Anonymous30-Oct-02 16:53 
GeneralRe: detecting server socket reset Pin
Member 1006688325-Jun-14 2:53
Member 1006688325-Jun-14 2:53 
GeneralDisable Item in ListBox Pin
:_Rocket_:30-Oct-02 16:45
:_Rocket_:30-Oct-02 16:45 
GenerallParam vs wParam Pin
stevenson30-Oct-02 16:36
stevenson30-Oct-02 16:36 
GeneralRe: lParam vs wParam Pin
Anatari30-Oct-02 17:05
Anatari30-Oct-02 17:05 
I believe wParam and lParam are both 32 bit types. To use them you can cast any data type that is 32 bits or smaller to either lParam or wParam and past them as arguments to the ::PostMessage() function.

Example:
<br />
CObject *pObj = new CObject(); // Pointer to some object<br />
<br />
// Where hWnd is the window handle to post the message to<br />
::PostMessage(hWnd,MESSAGE_ID,(WPARAM)pObj,NULL);<br />


Then handle the message in the window that recievies it by declaring it in the message map and writing a function to handle the message.

<br />
// Message map entry<br />
ON_MESSAGE(MESSAGE_ID,OnMessage)<br />
<br />
// Message handler<br />
LRESULT CSomeClass::OnMessage(WPARAM wParam, LPARAM lParam) {<br />
// Cast wParam back to an object pointer<br />
CObject *pObj = (CObject *)wParam;<br />
// Now you can do whatever you want with the object pointer<br />
}<br />


Note: none of the code is tested and written off the top of my head.

- Anatari
GeneralRe: lParam vs wParam Pin
Paul M Watt30-Oct-02 18:14
mentorPaul M Watt30-Oct-02 18:14 
GeneralRe: lParam vs wParam Pin
devvvy30-Oct-02 18:24
devvvy30-Oct-02 18:24 
GeneralMulti-threading Pin
Gary Kirkham30-Oct-02 16:31
Gary Kirkham30-Oct-02 16:31 
GeneralRe: Multi-threading Pin
Joaquín M López Muñoz30-Oct-02 20:07
Joaquín M López Muñoz30-Oct-02 20:07 
GeneralRe: Multi-threading Pin
Gary Kirkham1-Nov-02 3:35
Gary Kirkham1-Nov-02 3:35 
GeneralIE Pin
candan30-Oct-02 16:11
professionalcandan30-Oct-02 16:11 
GeneralRe: IE Pin
Stephane Rodriguez.30-Oct-02 19:33
Stephane Rodriguez.30-Oct-02 19:33 
GeneralRe: IE Pin
candan30-Oct-02 20:14
professionalcandan30-Oct-02 20:14 
GeneralRe: IE Pin
Stephane Rodriguez.30-Oct-02 20:20
Stephane Rodriguez.30-Oct-02 20:20 
GeneralRe: IE Pin
candan30-Oct-02 21:43
professionalcandan30-Oct-02 21:43 
GeneralRe: IE Pin
Stephane Rodriguez.30-Oct-02 21:54
Stephane Rodriguez.30-Oct-02 21:54 
GeneralCListCtrl / CListBox and Icons Pin
JoeSox30-Oct-02 15:39
JoeSox30-Oct-02 15:39 
GeneralRe: CListCtrl / CListBox and Icons Pin
dabs31-Oct-02 4:24
dabs31-Oct-02 4:24 
GeneralRe: CListCtrl / CListBox and Icons Pin
JoeSox31-Oct-02 4:52
JoeSox31-Oct-02 4:52 
GeneralOverlapped I/O and Completion Port :: Winsock Pin
valikac30-Oct-02 12:18
valikac30-Oct-02 12:18 
GeneralRe: Overlapped I/O and Completion Port :: Winsock Pin
User 988530-Oct-02 12:46
User 988530-Oct-02 12:46 
GeneralRe: Overlapped I/O and Completion Port :: Winsock Pin
valikac30-Oct-02 14:08
valikac30-Oct-02 14:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.