Windows message IDs to text descriptions??
Is there anyway to get a text description a message being processed by a window? I want to output a log of windows messages being sent to my Window and was just wondering if there was an easy way of translating a message Id to it''s text description.
Thanks,
BrianH
You have to do that yourself.
example:>
however a much cleaner approach would be something like this:>
if this was what you wanted...
example:>
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ switch(uMsg) { case WM_ACTIVATE: logFile.out("WM_ACTIVATE"); break; case WM_CREATE: logFile.out("WM_CREATE"); break; }; return DefWndProc(hWnd, uMsg, wParam, lParam);}
however a much cleaner approach would be something like this:>
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ LogMessage(uMsg); switch(uMsg) { // do this and that }; return DefWndProc(hWnd, uMsg, wParam, lParam);}void LogMessage(UINT uMsg){ switch(uMsg) { case WM_ACTIVATE: logFile.out("WM_ACTIVATE"); return; case WM_CREATE: logFile.out("WM_CREATE"); return; };}
if this was what you wanted...
Have you tried FormatMessage? It can search the system for the string associated with a message id (I don''t know if there are any strings associated with regular messages), so it''s worth a try.
Thanks for the replies.
I tried FormatMessage() and it looks like it gets error code strings and general system messages, or something of that sort.
Oh well, its nothing of great importance. I just wanted to see what messages where getting sent around.
Thanks anyways!
-Brian
I tried FormatMessage() and it looks like it gets error code strings and general system messages, or something of that sort.
Oh well, its nothing of great importance. I just wanted to see what messages where getting sent around.
Thanks anyways!
-Brian
Isn''t the source for Spy++ available somewhere?
AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.
AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.
quote:Original post by Arild FinesGood point.
Isn''t the source for Spy++ available somewhere?
heh, I just come up with a very easy solution, i think...
[edited by - pag on May 27, 2003 3:33:12 PM]
#define STRING_WM_ACTIVATE "WM_ACTIVATE"#define STRING_WM_CREATE "WM_CREATE"#define Message2String(msg)STRING_##msgLRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ logFile.out(Message2String(uMsg)); switch(uMsg) { // do whatever... }; return DefWindowProc(hWnd, uMsg, wParam, lParam);}
[edited by - pag on May 27, 2003 3:33:12 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement