Author Topic: TIP - RegisterWindowMessage  (Read 3188 times)

0 Members and 1 Guest are viewing this topic.

Offline Patrice Terrier

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2401
  • Gender: Male
    • www.zapsolution.com
TIP - RegisterWindowMessage
« 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.

Code: [Select]
NewMessageID = RegisterWindowMessageA("QueryCancelAutoplay")
...
SELECT CASE wMsg
CASE WM_QUERYCANCELAUTOPLAY '// Monitor DeviceNotification.
     FUNCTION = 1           '// Stop the notification popup
     EXIT FUNCTION
« Last Edit: May 11, 2007, 11:02:26 PM by José Roca »
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com