VB.NET - Automate desktop apps with Sendkeys and Win32 functions

JFLHV
JFLHV
1.8 هزار بار بازدید - 3 سال پیش - How I automate Windows desktop
How I automate Windows desktop apps with VB.NET using Sendkeys and Win32 functions. It covers waiting until a specific window is active, explicit wait, simulating keyboard input with Sendkeys and simulating left click and right click. Win32 ------------------- Private Declare Function GetForegroundWindow Lib "user32" () As IntPtr Private Declare Auto Function GetWindowText Lib "user32" (ByVal hWnd As System.IntPtr, ByVal lpString As System.Text.StringBuilder, ByVal cch As Integer) As Integer Public Declare Sub mouse_event Lib "user32" (ByVal dwFlags As UInteger, ByVal dx As UInteger, ByVal dy As UInteger, ByVal dwData As UInteger, ByVal dwExtraInfo As Integer) Const MOUSEEVENTF_LEFTDOWN As UInteger = &H2 Const MOUSEEVENTF_LEFTUP As UInteger = &H4 Const MOUSEEVENTF_RIGHTDOWN As UInteger = &H8 Const MOUSEEVENTF_RIGHTUP As UInteger = &H10 Regex function -------------------------- Regex.Replace(str, "[+^%~(){}]", "{$0}") Sendkeys Codes --------------------------- docs.microsoft.com/en-us/dotnet/api/system.windows… 0:00 Summary of automation tasks 0:20 Wait for active window 1:22 Sendkeys functions 2:45 Mouseclicks 3:32 Demo UI to run scripts
3 سال پیش در تاریخ 1400/11/19 منتشر شده است.
1,813 بـار بازدید شده
... بیشتر