Программное нажатие кнопки



Оформил: DeeCo

{ 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);







Copyright © 2004-2025 "Delphi Sources" by BrokenByte Software. Delphi World FAQ

Группа ВКонтакте