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.

  • DIV

    The DIV tag in HTML is used to create a DIVision of data, essentially a block.

  • FAT
    The FAT (File Allocation Table) file system has its origins in the late 1970s and early 1980s and was the file system supported by the Microsoft MS-DOS operating system. It was originally developed as a simple file system suitable for floppy disk drives less than 500K in size. Over time it has been enhanced to support larger and larger media. Currently there are three FAT file system types: FAT12, FAT16 and FAT32. The basic difference in these FAT sub types, and the reason for the names, is the size, in bits, of the entries in the actual FAT structure on the disk. There are 12 bits in a FAT12 FAT entry, 16 bits in a FAT16 FAT entry and 32 bits in a FAT32 FAT entry.
  • fail
  • module
  • short