Mega Code Archive

 
Categories / Delphi / Examples
 

Press a button by code

Title: press a button by code? { 1. Way: Sending a Message } Button1.Perform(WM_LBUTTONDOWN, 0, 0); Button1.Perform(WM_LBUTTONUP, 0, 0); { 2. Way: With the Click Method } Button1.Click; { 3. Way: With a pressed effect: The BM_SETSTATE message is sent by an application to change the highlight state of a button. } SendMessage(Button2.Handle, BM_SETSTATE, 1, 0); Button2.Click; Sleep(100); // Some delay PostMessage(Button2.Handle, BM_SETSTATE, 0, 0); Links: ...simulate the pressing of keyboard keys ? ...das dr cken von Tastatur Tasten simulieren ?