Home > Windows API > How to get the string that is used to register a message using RegisterWindowMessage

How to get the string that is used to register a message using RegisterWindowMessage

It’s quite common that we use RegisterWindowMessage to register a message that is used for all instances of this application.

Have you ever wondered how to get the text back from from the message number that is returned by RegisterWindowMessage?

This will make it more clear…

const UINT uMyWndMessageReg = ::RegisterWindowMessage( _T( "Nibu is testing" ));

// Now how to get back "Nibu is testing" from <em>uMyWndMessageReg</em>?
// Well this is how we do it...

TCHAR szMsgBuf[ MAX_PATH ] = { 0 };
GetClipboardFormatName( uMyWndMessageReg, szMsgBuf, MAX_PATH ); 

MessageBox( NULL,
            szMsgBuf,
            _T( "RegisterWindowMessage String" ),
            MB_OK | MB_ICONINFORMATION );

Ah wait I have a question for you, can you tell me what’s going behind the scenes of RegisterWindowMessage. 😉

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: