Archived

This topic is now archived and is closed to further replies.

message identifier

This topic is 5012 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I send different messages (structs) to a message handler. #define WM_NAME_1 1001 #define WM_NAME_2 1002 struct msg_Kind_1 { DWORD msg_id; //message identifier char Name[24]; }; I give every message struct to send a message identifier. msg_Kind_1 msg_1; msg_1.msg_id = WM_NAME_1; In the message handler I get the message identifier by the following macro. #define GET_MSGID(p)(*((DWORD *)(p))) In the message handler I save the received message in "rd" ... PBYTE rd = ( (DPNMSG_RECEIVE *) pMessage)->pReceiveData; ... and try to get the message identifier. switch(GET_MSGID (rd)) { case WM_NAME_1: ... ... How can I contol if the a message I get in the message handler also is a struct that has a message identifier? If have to control it before calling the makro "GET_MSGID", because my application crashs here and it seems that my message handler get other messages without a message identifier I defined. Thanks for reply in advance.

Share this post


Link to post
Share on other sites
It''s hard to know exactly which messages windows has defined for its own use, so they gave us a marker. The way you''re supposed to define new messages is via the ''WM_USER'' constant ...

#define WM_MYMSG1 WM_USER + 1
#define WM_MYMSG2 WM_USER + 2

etc...

Share this post


Link to post
Share on other sites
Thanks for your reply! It''s not the ID of a window, it''s the ID of a message. Every time I close my client, the server crashs and here I get a foul?!

Seems the server get erratic messages after closing my client or what?

Share this post


Link to post
Share on other sites