Syndicate content

Recover name of message registered with RegisterWindowMessage()

Today I was confronted with an error in a process that would run in the background and slowly fill up the Windows message queue when it should have been dormant.

I looked at the messages that were being processed once the process woke up and the message number was 0xC10C or so. Nothing in the software has such a number. So I looked around and found out that the message was one of those created using the RegisterWindowMessage() function. (This is wrong in that application since the messages are never used from external applications, but oh well... that does not change the basic problem.)

So, I had a to determine what message 0xC10C represented, It felt like there was no way to convert the number back to the string used to create the message identifier. In fact, there isn't a specialized function for that. However, the RegisterWindowMessage() function is actually doing the exact same thing as RegisterClipboardFormat()... and yes, we can use the opposite to restore the message name: GetClipboardFormatName().

So...

UINT msgid = RegisterWindowMessage("Some_Weird_Name_Here");
...
wchar_t buf[256];
GetClipboardFormatNameW(msgid, buf, sizeof(buf) / sizeof(buf[0]);
// Here buf == "Some_Weird_Name_Here"

That way I could print out the message name and find the culprit in the source code.

Syndicate content

Diverse Realty

Diverse Realty Team

Want a New Home?
Want to Sell Your House?

Call Alex at
+1 (916)
220 6482

Alexis Wilke, Realtor
Salesperson
Lic. # 02024063

Cory Marcus, Broker
Lic. # 01079165

     

Terms of Site Index

Find the page/content you are looking for with our index.

  • cvs

    CVS is a control source tool that has been used for a quite long time. It uses RCS as its bottom layer (RCS is limited to a single computer environment.) Each time the source code is checked in with a diff so one can always retrieve a previous version. CVS is often being replaced with SVN.

  • exclusive
  • extermely
  • stack
  • tree