Today, my friend said that he was disgusted by the company's learning website. After work, he asked him to read the learning materials. After reading the next page, he asked him how long he had to stay on the next page to click the next page, I couldn't even see it, so in the evening I had a whim to give him a program to simulate the mouse buttons, so that the mouse can be triggered at regular intervals, by the way, the program is minimized to the bottom right corner.
First, you need to reference the user32.dll file, which is found in the computer. C: \ Windows \ System32 is searched and copied to the debug directory.
The following is the solution code.
, CharSet = CharSet. auto, CallingConvention = mouse_event (dwFlags, dx, dy, cButtons, MOUSEEVENTF_MOVE =; MOUSEEVENTF_LEFTDOWN =; events =; MOUSEEVENTF_RIGHTDOWN =; events =; MOUSEEVENTF_ABSOLUTE =; timereffectick (| MOUSEEVENTF_LEFTUP, Cursor. position. x, Cursor. position. y, | MOUSEEVENTF_LEFTUP | MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, Cursor. position. x, Cursor. position. Y ,,View Code
This is the design interface
Form1_Resize (. WindowState ===. ShowInTaskbar =;
Restore the form when double-clicking the minimize icon
notifyIcon1_MouseDoubleClick( (!.ShowInTaskbar = .WindowState =
After completing the overall work, remember to give the policyicon control an icon. Run the program, start the button, and minimize the program. Then, the mouse clicks the program at intervals.
Extended: You can add the keyboard Button Function to simulate the keyboard button at a specified time. Whether the simulated mouse wheel can be added. If necessary, you can continue writing the code.