Powerbasic Museum 2020-B

IT-Consultant: Patrice Terrier => Useful TIPS => Topic started by: Patrice Terrier on May 11, 2007, 04:34:52 PM

Title: TIP - RegisterWindowMessage
Post by: Patrice Terrier on May 11, 2007, 04:34:52 PM
 
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