This article describes in detail how to implement the message sending control scroll bar in delphi. The main functions and usage are as follows. If you are interested, refer
1. Perform functions
Copy codeThe Code is as follows:
DBGrid1.Perform (WM_VSCROLL, SB_PAGEDOWN, 0); // control the scroll bar and flip back
DBGrid1.Perform (WM_VSCROLL, SB_PAGEUP, 0); // control the scroll bar and flip the page forward
2. SendMessage Function
Copy codeThe Code is as follows:
SendMessage (DBGrid1.Handle, WM_VSCROLL, SB_PAGEDOWN, 0 );
SendMessage (DBGrid1.Handle, WM_VSCROLL, SB_PAGEUP, 0 );
3. PostMessage Function
Copy codeThe Code is as follows:
PostMessage (DBGrid1.Handle, WM_VSCROLL, SB_PAGEDOWN, 0 );
PostMessage (DBGrid1.Handle, WM_VSCROLL, SB_PAGEUP, 0 );
Note: (2, 3 function differences)
PostMessage only puts the message into the queue. No matter whether other programs process the message or not, the message is returned and then continues to be executed;
However, SendMessage must not be returned until other programs process the message.
The returned value of PostMessage indicates whether the PostMessage function is correctly executed;
The return value of SendMessage indicates the return value after other programs process the message.
The most important thing to use these two message sending functions is to check whether your program needs to pay attention to the Message lag. PostMessage will cause the message lag, while SendMessage will not, however, if the SendMessage Message Processing fails, the program will be stopped!