Skip to main content
GameDev.net gamedev.net
🔒 Locked

message identifier

Started by Praction_X Mar 28, 2004 at 3:41 AM 1 replies 250+ views
Original Post
Praction_X
Praction_X
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.
Jerry Velders
Jerry Velders
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...
Too old for this ...
Praction_X
Praction_X
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?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.