C # Use spy for simulation,
I was helpless. I wrote it for a long time. When I finally saved it, the webpage lost its response. It was really terrible. I wanted to give up on this, but I still want to roughly rewrite it once. I hope it will be helpful to my friends in the future.
The Microsoft. Spy tool is a basic tool. Let's briefly introduce how to use it:
Spy comes with vs and can be downloaded directly from the Internet.
Open the spy tool. The main interface is as follows:
Today, we use vnc as an example.
The target is to write 192.168.2.200 to the server, and click the second button of Options.
Step 1: Obtain the vnc form and use spy to find the form
Drag the search tool icon to the desired interface.
In this way, we can find the required form.
FindWindow can be used to search for the first main form and class name or title.
Findjavaswex allows you to find controls in the form.
SendMessage sends a message to the form.
Enable and window search and search controls.
1 [DllImport ("user32.dll", EntryPoint = "FindWindow", SetLastError = true)] 2 // parameter 1: Class Name. Parameter 2 refers to the Title name of the window. The two must have at least one 3 public static extern IntPtr FindWindow (string lpClassName, string lpWindowName); 4 5 6 [DllImport ("user32.dll", SetLastError = true, CharSet = CharSet. auto)] 7 public static extern IntPtr find1_wex (IntPtr parentHandle, IntPtr childAfter, string lclassName, string windowTitle); 8 9 [DllImport ("user32.dll", EntryPoint = "SendMessage ", setLastError = true, CharSet = CharSet. auto)] 10 public static extern IntPtr SendMessage (IntPtr hwnd, uint wMsg, int wParam, string lParam); 11 12 [DllImport ("user32.dll", EntryPoint = "SendMessage ", setLastError = true, CharSet = CharSet. auto)] 13 public static extern IntPtr SendMessage (IntPtr hwnd, uint wMsg, int wParam, int lParam );
1 IntPtr win = FindWindow (null, "VNC Viewer: Connection Details"); 2 if (win! = IntPtr. Zero) 3 {4 IntPtr winComboBox = find1_wex (win, new IntPtr (), "ComboBox", null); 5 if (winComboBox! = IntPtr. zero) 6 {7 IntPtr winEdit = find1_wex (winComboBox, new IntPtr (), "Edit", null); 8 9 IntPtr resultEdit = SendMessage (winEdit, 0xC, 0, "192.168.2.100"); 10 11 12 // get the first Button 13 IntPtr button1 = find1_wex (win, new IntPtr (), "Button", "& Options... "); 14 15 if (button1! = IntPtr. Zero) 16 SendMessage (button1, 0xF5, 0, 0); // Click Event 17 18 if (winEdit! = IntPtr. zero) 19 {20 MessageBox. show ("find edit box"); 21} 22 // MessageBox. show ("find drop-down box"); 23} 24 else25 {26 // MessageBox. show ("drop-down box not found"); 27} 28 29 30 MessageBox. show ("found form"); 31} 32 else33 {34 MessageBox. show ("no form found"); 35} 36}
The execution result is as follows:
If there are no titles for multiple buttons, you can only obtain them one by one, as shown below:
If any of you have other methods, please kindly advise.
1 IntPtr button1 = FindWindowEx(win, new IntPtr(), "Button", null);2 IntPtr button2 = FindWindowEx(win, button1, "Button", null);
C :\
Yes
Refer to this to clean up the C drive:
1. Disable System Restoration: My computer properties/System Restoration/disable System Restoration on all disks, but I will not be able to use system restoration in the future!
2. Disable System sleep: Control Panel/Power Supply/sleep/remove the check before starting system sleep
3. move the virtual memory, my computer properties/advanced/performance/settings/advanced/change/select the C disk, that is, the system disk, select the no-score page, and then set the virtual memory to its disk, A disk with more disk space remaining, such as D, E, and F. set to 1.5 ~ of memory ~ 2.5 times. The size can be set to the same!
5. Clear temporary IE folders, internet Options, and delete temporary and offline files.
6. delete system logs and program logs, my computer/control panel/management tools/Computer Management/Event Viewer/application, right-click/clear events, and clear system logs in sequence
7. Clear system cache: 2000 all files in the system: C: \ WINNT \ system32 \ dllcache
The XP system is: C: \ windows \ system32 \ dllcache all files under the system cache (open my computer/tool/file and Folder Options/hide the protected system file hook off to hide all files on the hook) ). You can also run the sfc.exe/purgecache command to automatically delete the file.
8. Clear the recycle bin
9. delete the files under c: \ windows \ SoftwareDistribution \ Download (the files downloaded when the system is updated are useless if you have installed the updates)
10. Delete all directories under c: \ windows \ RegisteredPackages
11. Delete all Files under C: \ WINDOWS \ Downloaded Program Files
12. view the hidden files that are known to be protected by the system in my computer folder option, and check all the files.
13. Delete c: \ windows \ All files with $8882305 $ (backup files after system update)
Zhidao.baidu.com/question/11035955.html
Zhidao.baidu.com/question/12223613.html
Zhidao.baidu.com/question/14874715.html
... The remaining full text>
C :\
Yes
Refer to this to clean up the C drive:
1. Disable System Restoration: My computer properties/System Restoration/disable System Restoration on all disks, but I will not be able to use system restoration in the future!
2. Disable System sleep: Control Panel/Power Supply/sleep/remove the check before starting system sleep
3. move the virtual memory, my computer properties/advanced/performance/settings/advanced/change/select the C disk, that is, the system disk, select the no-score page, and then set the virtual memory to its disk, A disk with more disk space remaining, such as D, E, and F. set to 1.5 ~ of memory ~ 2.5 times. The size can be set to the same!
5. Clear temporary IE folders, internet Options, and delete temporary and offline files.
6. delete system logs and program logs, my computer/control panel/management tools/Computer Management/Event Viewer/application, right-click/clear events, and clear system logs in sequence
7. Clear system cache: 2000 all files in the system: C: \ WINNT \ system32 \ dllcache
The XP system is: C: \ windows \ system32 \ dllcache all files under the system cache (open my computer/tool/file and Folder Options/hide the protected system file hook off to hide all files on the hook) ). You can also run the sfc.exe/purgecache command to automatically delete the file.
8. Clear the recycle bin
9. delete the files under c: \ windows \ SoftwareDistribution \ Download (the files downloaded when the system is updated are useless if you have installed the updates)
10. Delete all directories under c: \ windows \ RegisteredPackages
11. Delete all Files under C: \ WINDOWS \ Downloaded Program Files
12. view the hidden files that are known to be protected by the system in my computer folder option, and check all the files.
13. Delete c: \ windows \ All files with $8882305 $ (backup files after system update)
Zhidao.baidu.com/question/11035955.html
Zhidao.baidu.com/question/12223613.html
Zhidao.baidu.com/question/14874715.html
... The remaining full text>