Send windows key in vbs?

前端 未结 5 843
生来不讨喜
生来不讨喜 2021-01-12 18:12

I\'ve looked everywhere for this, is it actually possible to do? If you press WIN + LEFT ARROW it will mount your selected window to the left of your screen, and that\'s exa

5条回答
  •  终归单人心
    2021-01-12 18:50

    a very late response, but here is my working effort

    Dim shellObject : Set shellObject = CreateObject("WScript.Shell")
    Extern.Declare micVoid, "keybd_event", "user32.dll", "keybd_event", micByte, micByte, micLong, micLong
    Const KEYEVENTF_KEYUP = &H2
    Const VK_LWIN = &H5B
    
    Wait 5
    Call Extern.keybd_event(VK_LWIN,0,0,0) 'press win key
    Wait 5
    shellObject.SendKeys  "({UP})" 'right aline the window. TODO Error handlng
    Wait 5
    Call Extern.keybd_event(VK_LWIN,0,KEYEVENTF_KEYUP,0) 'up win key
    Set shellObject = Nothing
    

提交回复
热议问题