VC: Let the application prohibit Windows screen protection Zhou Xindong (12/12/1999) ---- If you need a long time period in your program to make a lot of data processing, this time is enough to make Windows Detecting the user action and activates the screen saver. Once the screen saver is started, your program runs actually slow, which greatly affects the normal operation of the program. Is there a way to turn off the screen protection before the program is processed for a long time? The answer is yes. Windows sends a WM_SYSCOMMAND message to the currently activated application before starting the screen saver, where the WPARAM parameter specifies the upcoming system command type, in this example is SC_Screensave. The problem is how the program captures this message? This message can be processed using the TAPPLICATION class onMessage event handle in C Builder. The application will trigger the onMessage event of the TAPPLICATION class after receiving any Windows messages. By defining the handler of this event, you can capture all Windows messages sent to the application (this is of course not included in the program in the program.) . ---- OnMessage events defined as follows: typedef void__fastcall (__ closure * TMessageEvent) (tagMSG & Msg, bool & Handled); __property TMessageEvent OnMessage = {read = FOnMessage, write = FOnMessage}; ---- wherein TMessageEvent type is the type of event OnMessage It defines the method of processing the message. The MSG parameter gives the relevant information of the Windows message. The structure is as follows: typedef struct tagmsg {hwnd hwnd; uint message; wparam wparam; lparam lparam; dWORD TIME; POINT PT;} --- - Handled parameter determines how to perform the next step of the message, if the Handled parameter is set to True after receiving a message, the message will not be further processed, in this example, the activation of the screen saver is canceled.