• Welcome to Theos PowerBasic Museum 2017.

TIP - RegisterWindowMessage

Started by Patrice Terrier, May 11, 2007, 04:34:52 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Patrice Terrier

 
Very few people know how to use RegisterWindowMessage. However this function is a real gem that would let you define a new window message that is guaranteed to be unique throughout the system.

The message value can be used when sending or posting messages.

Syntax

NewMessageID = RegisterWindowMessage("TheMessageToBeRegistered")

Example

You can use it to stop the nasty Windows notification popup when a CD or DVD is inserted in the tray.


NewMessageID = RegisterWindowMessageA("QueryCancelAutoplay")
...
SELECT CASE wMsg
CASE WM_QUERYCANCELAUTOPLAY '// Monitor DeviceNotification.
     FUNCTION = 1           '// Stop the notification popup
     EXIT FUNCTION

Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com