For Programmers: Free Programming Magazines  


Home > Archive > VC Language > June 2005 > how report message strings









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author how report message strings
ragi

2005-06-11, 3:59 pm

How can I translate messages from for example WindowProc into string?

0x0018 -> "WM_SHOWWINDOW"

Of course in program when I want trace sth. Like Spy++ but in my code.
Doug Harrison [MVP]

2005-06-11, 3:59 pm

On Sat, 11 Jun 2005 18:53:00 +0200, ragi wrote:

> How can I translate messages from for example WindowProc into string?
>
> 0x0018 -> "WM_SHOWWINDOW"
>
> Of course in program when I want trace sth. Like Spy++ but in my code.


You'll have to create a mapping from message number to string, e.g.

typedef std::map<int, std::string> Map;
Map m;
m[WM_SHOWWINDOW] = "WM_SHOWWINDOW";

Then you can look it up with:

Map::iterator i = m.find(WM_SHOWWINDOW);
if (i != m.end()) ...

--
Doug Harrison
Microsoft MVP - Visual C++
ragi

2005-06-11, 3:59 pm

Ok. But there are hundreds of strings. Maybe is any ready solve of this
problem. Sth like FormatMessage for errors ....

Doug Harrison [MVP] wrote:

> On Sat, 11 Jun 2005 18:53:00 +0200, ragi wrote:
>
>
>
>
> You'll have to create a mapping from message number to string, e.g.
>
> typedef std::map<int, std::string> Map;
> Map m;
> m[WM_SHOWWINDOW] = "WM_SHOWWINDOW";
>
> Then you can look it up with:
>
> Map::iterator i = m.find(WM_SHOWWINDOW);
> if (i != m.end()) ...
>

Doug Harrison [MVP]

2005-06-11, 3:59 pm

On Sat, 11 Jun 2005 19:14:09 +0200, ragi wrote:

> Ok. But there are hundreds of strings. Maybe is any ready solve of this
> problem. Sth like FormatMessage for errors ....


Not that I'm aware of. The spyxx.exe program has the strings embedded in
the executable.

--
Doug Harrison
Microsoft MVP - Visual C++
ragi

2005-06-11, 3:59 pm

Sad information...

Doug Harrison [MVP] wrote:

> On Sat, 11 Jun 2005 19:14:09 +0200, ragi wrote:
>
>
>
>
> Not that I'm aware of. The spyxx.exe program has the strings embedded in
> the executable.
>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com