' ==========================================================================
‘
' VBScript Source File--Created with SAPIEN Technologies primalscript 4.0
‘
' NAME:
‘
' Author:microsoft, Microsoft
' DATE:2014/8/10
‘
' COMMENT:
‘
' =================== define variables, register API objects ==================================
Dim Userwrap,hwnd
Set Userwrap = CreateObject ("Dynamicwrapper")
Set ws=wscript.createobject ("Wscript.Shell")
Wscript.Sleep 500
Ws. Run "Calc", 0
Wscript.Sleep 500
' Declare Function showwindow Lib ' user32 ' Alias ' ShowWindow ' (ByVal hwnd as Long, ByVal nCmdShow as long) as long
Userwrap.register "USER32. DLL "," ShowWindow "," I=hl "," F=s "," r=l "
' Declare Function FindWindow Lib ' user32 ' Alias ' Findwindowa ' (ByVal lpclassname As String, ByVal Lpwindowname as String) As Long
Userwrap.register "USER32. DLL "," FindWindow "," I=ss "," F=s "," r=l "
' Declare Function setwindowpos Lib ' user32 ' Alias ' SetWindowPos ' (ByVal hwnd as Long, ByVal hwndinsertafter as Long, ByVal X as long, ByVal y as Long, ByVal CX as Long, ByVal Cy as Long, ByVal wflags as long) as long
Userwrap.register "USER32. DLL "," SetWindowPos "," i=hllllll "," F=s "," r=l "
' Declare Function PostMessage Lib ' user32 ' Alias ' Postmessagea ' (ByVal hwnd as Long, ByVal wmsg as Long, ByVal WParam as L Ong, LParam as any)
Userwrap.register "USER32. DLL "," PostMessage "," I=hlls "," F=s "," r=l "
' Declare Function setwindowtext Lib ' user32 ' Alias ' setwindowtexta ' (ByVal hwnd as Long, ByVal lpstring as String) as Long
Userwrap.register "USER32. DLL "," SetWindowText "," I=hs "," F=s "," r=l "
' Declare Function FindWindowEx Lib ' user32 ' Alias ' findwindowexa ' (ByVal hWnd1 as Long, ByVal HWnd2 as Long, ByVal lpsz1 A s string, ByVal lpsz2 as String) as Long
Userwrap.register "USER32. DLL "," FindWindowEx "," I=llss "," F=s "," r=l "
' Declare Function setcursorpos Lib ' user32 ' (ByVal X as Long, ByVal Y as long) as long
Userwrap.register "USER32. DLL "," Setcursorpos "," I=ll "," F=s "," r=l "
' =================== find control or form handle ===============================
HWnd = Userwrap.findwindow (vbNullString, "calculator")
' HWnd = Userwrap.findwindow ("kugou_ui", vbNullString)
HWnd1 = Userwrap.findwindowex (Hwnd,0,vbnullstring,edit)
' Userwrap.showwindow hwnd,sw_hide
' Userwrap.setwindowtext hWnd, ' Hello World '
' MsgBox hWnd
' MsgBox HWnd1
' Userwrap.setwindowpos hWnd,-1, 0, 0, 0, 0, 3
' MsgBox ' Move the mouse to the top left corner "
' Userwrap.setcursorpos 0,0
' ================= defines system constants ===========================
Private Const wm_keydown = &h100
Private Const wm_keyup= &h101
Private Const WM_CHAR = &h102
Public Const Wm_syskeydown = &h104
Public Const Wm_syskeyup = &h105
' ================= send F1 button =====================
Userwrap.postmessage hWnd, WM_KEYDOWN, 112, 0
' ================= send 1002========================
Userwrap.postmessage Hwnd,wm_keydown, 97,0
Userwrap.postmessage Hwnd,wm_keydown, 96,0
Userwrap.postmessage Hwnd,wm_keydown, 96,0
Userwrap.postmessage Hwnd,wm_keydown, 98,0