[haiku-development] Re: Intercepting messages between the applications and App. Server

  • From: André Braga <meianoite@xxxxxxxxx>
  • To: "haiku-development@xxxxxxxxxxxxx" <haiku-development@xxxxxxxxxxxxx>
  • Date: Fri, 29 May 2009 14:39:25 -0300

Em 29/05/2009, às 09:47, "Yashasvi A.C." <yashasviac@xxxxxxxxx> escreveu:

Hey guys,

Thanks for the help. I figured it out. :) Was a problem with the namespace of the function. When I try to print out message->what, it prints out a number like 1400700986 or something similar of that sort. Is there any way where I can access the name of the message, like MOUSE_DOWN or CLICK or something like that? Under BMessage, only "what" is listed as a data member.

Thanks once again for the help.
Yash

I'm not an expert at all, but I can tell you that B_MOUSE_DOWN and the like are symbolic constants that are represented by 32 bit integes, not strings; so you won't really find pretty names when you dump those BMessages. Unless you're using a smarter debugger than stock GDB, you'll have to do the translation to the constant of interest manually. See the headers that you're including for these message types: they will tell you the correspondence. Beware of endianness and all.

Sometimes it helps to print the "what" field as a hex number, and see if a 4-letter ASCII string (possibly inverted, i.e. byteswapped) comes out of it. Some kits and apps use those 4-letters-ish forms. You might want instead to use some bitmasks and shifts and typecasts to extract and print those letters directly.


HTH,
Cheers,
A.

Other related posts: