User defined Message with additional data? 
Author Message
 User defined Message with additional data?

Hi

How can I send a user defined message to a window with additional data?

With WM_COMMAND I can send a user defined message, but without additional
data:
GetParent()->SendMessage(WM_COMMAND, GetDlgCtrlID() | MYOWNMESSAGE <<16),
(LONG)GetSafeHwnd())

With WM_NOTIFY MFC sends additional data. But how can I send my own user
defined message?

Thanks for your help!

Matthias.



Fri, 20 Oct 2000 03:00:00 GMT  
 User defined Message with additional data?

Off the top of my head I think this is correct:

#define WM_SOME_MESSAGE WM_USER+1

// in message map of .cpp file:
ON_MESSAGE(WM_SOME_MESSAGE, OnMyMessage)

// in header file:
afx_msg LRESULT OnMyMessage(WPARAM wParam, LPARAM lParam);

// function body in .cpp file
LRESULT CMyClass::OnMyMessage(WPARAM wParam, LPARAM lParam)
{
    // do whatever processing...
   return (TRUE or FALSE);

Quote:
}

Use PostMessage or SendMessage
Quote:

>Hi

>How can I send a user defined message to a window with additional data?

>With WM_COMMAND I can send a user defined message, but without additional
>data:
>GetParent()->SendMessage(WM_COMMAND, GetDlgCtrlID() | MYOWNMESSAGE <<16),
>(LONG)GetSafeHwnd())

>With WM_NOTIFY MFC sends additional data. But how can I send my own user
>defined message?

>Thanks for your help!

>Matthias.



Sun, 22 Oct 2000 03:00:00 GMT  
 User defined Message with additional data?

Quote:

> Hi

> How can I send a user defined message to a window with additional data?

> With WM_COMMAND I can send a user defined message, but without additional
> data:
> GetParent()->SendMessage(WM_COMMAND, GetDlgCtrlID() | MYOWNMESSAGE <<16),
> (LONG)GetSafeHwnd())

> With WM_NOTIFY MFC sends additional data. But how can I send my own user
> defined message?

> Thanks for your help!

> Matthias.

The WM_COPYDATA message contains a pointer to some user-defined data in
memory of any reasonable size, and Windows copies that data to the
receiving process' address space.  So it can be used to send just about
anything you want.


Sun, 22 Oct 2000 03:00:00 GMT  
 User defined Message with additional data?

Quote:

>Hi

>How can I send a user defined message to a window with additional data?

> ...snip....

How about using WM_COPYDATA?

Don McClimans
Inti Electronics


IntiElectronics.com    / my true e-mail adddress

My return address is altered to discourage junk mail.



Tue, 24 Oct 2000 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Windows.Forms.Message - processing a user defined Windows-message - 2nd try

2. User defined messages and the message loop

3. handling user-defined messages (WM_USER) with message maps

4. User define message is lost in the thread!!!

5. user defined, attach to message

6. user defined messages

7. User defined messages..

8. User defined messages in Release

9. User defined messages only for mainfrm?

10. Sending a user defined message

11. How to send User defined Message between CMDIChildWnd?

12. Catching user-defined messages

 

 
Powered by phpBB® Forum Software