The Linux Page

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.

  • HTML
  • PHP
  • PayPal

    An online credit card processor that anyone, including individuals, can use to get paid. Often viewed as expensive though.

  • index
  • nested

    In computing, nested means an item defined inside another. It is most often used for loops, a loop can be declared inside another. The one inside is called the nested loop. In particular, two loops can be defined one after another or one inside the other. There is no other way to declare a loop.