This article is a mirror article of machine translation, please click here to jump to the original article.

View: 23528|Reply: 8

[WinForm] Automatic input with a handle cannot be clicked to confirm the operation

[Copy link]
Posted on 3/22/2019 10:32:57 AM | | |
[DllImport("user32.dll", EntryPoint = "FindWindow")]
        private static extern IntPtr FindWindow(string IpClassName, string IpWindowName);
        [DllImport("User32.DLL")]
        public static extern int SendMessage(IntPtr hWnd,
         uint Msg, int wParam, string lParam);
        [DllImport("User32.DLL")]
        public static extern IntPtr FindWindowEx(IntPtr hwndParent,
         IntPtr hwndChildAfter, string lpszClass, string lpszWindow);
        public const uint WM_SETTEXT = 0x000C;

        private const string USERID = "170809";

        const int BM_CLICK = 0xF5;




IntPtr hwnd = FindWindow("#32770", "Verify U Password");

            if (hwnd != IntPtr.Zero)
            {
                while (hwnd == IntPtr.Zero) ;
                IntPtr vHandle = FindWindowEx(hwnd, IntPtr.Zero, "Edit", null);
                SendMessage(vHandle, WM_SETTEXT, 0, USERID);

            }


Auto-entry is possible, but the OK button cannot be clicked!!! Is there a big guy who comes out to give you some guidance!! Thank you very much





Previous:asp.net Customize 404 in MVC4
Next:Triggers for the foundation of the database
 Landlord| Posted on 3/22/2019 10:35:07 AM |
C:\Users\Administrator\Desktop\1553222067(1)
Posted on 3/22/2019 10:57:15 AM |
The hyperlink login is visible.


Solution: Before sending a click message, call the SetFrontgroundWindow function to set the button to the top level.
Then it will sleep for another 2 seconds, and finally send a sendmessage message to succeed.
But I still don't understand why I need to sleep for 2 seconds.
 Landlord| Posted on 3/22/2019 11:02:25 AM |
winds Posted on 2019-3-22 10:57
https://bbs.csdn.net/topics/391832951

Brother, this problem has been solved. The problem now is that the event of the text box is not fired. It didn't work to cause me to auto-enter either!!
 Landlord| Posted on 3/22/2019 11:04:58 AM |
winds Posted on 2019-3-22 10:57
https://bbs.csdn.net/topics/391832951

Focus Events
Posted on 3/22/2019 11:16:37 AM |
 Landlord| Posted on 3/22/2019 11:23:03 AM |

This window I caught it with the Win32 API. Now I don't know how to write this!!
Posted on 3/22/2019 4:10:50 PM |
Prompt:Authors are banned or removed content is automatically blocked
Posted on 3/22/2019 4:16:38 PM |
Prompt:Authors are banned or removed content is automatically blocked
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com