Using a keyboard to simulate mouse operations, text, cold air, or the technical weight of keyboard programming also requires a book, but it is not clear to me in a few words, and the ability is not enough. But I still do my best to use it for future review. The program can use the wm_keydown message to receive key messages. It usually calls case wm_keydown: Switch (wparam) {Case vk_up: getcursorpos (& pt); setcursorpos (pt. x, PT. y-10); break; Case vk_down: getcursorpos (& pt); setcursorpos (pt. x, PT. Y + 10); break; Case vk_space: mouse_event (mouseeventf_leftdown, 0, 0, 0); mouse_event (mouseeventf_leftup, 0, 0, 0); break ;}
The code above indicates that when you press the "upper mouse key", the cursor moves up. When you press the "lower mouse key", the cursor moves down. When you press the Space key, the mouse clicks are simulated. A wm_keydown message is a message action triggered when a user presses a key. Then, a switch statement is used to determine the key to be pressed. Wparam represents the virtual key code of each key on the keyboard. For example, vk_up is the cursor key, vk_down is the cursor key, and vk_space is the Space key. The following is the operation code. The PT in the above program is in the piont structure. It is also relatively simple to simulate the mouse action. Well, that's it. After learning it, I will write it again...