根据我的需要,我尝试通过程序运行Windows热键 Win + T 。 我尝试使用keybd_event和SendInput。它在Win8.1" Real"中无忧无虑。 OS。
现在,我尝试使用系统帐户运行资源管理器Shell的相同程序。
taskmgr -> kill explorer -> Psexec -s -i explorer.exe
或
taskmgr -> kill explorer -> nircmd.exe elevatecmd runassystem explorer.exe
不幸的是它不起作用, Win 或 T 单独工作但不是组合。 我也尝试使用autohotkey,这是一款不错的HotkeyP,但是没有成功。
我尝试使用系统用户,因为我专注于使用系统帐户的Win8.1PE。 一切都运行良好但任务栏已锁定,启动时禁用 Win + T ,手动点击,允许激活它,同样在Real Win8中使用资源管理器作为系统运行。
Spy ++中的一些消息行
<00001> 000100A6 P WM_HOTKEY idHotKey:01FB fuModifiers:MOD_WIN'T' [wParam:000001FB lParam:00540008]
<00004> 00010502 P message:0xC02B [Registered:"SHELLHOOK"] wParam:00000004 lParam:00000000
<00005> 00010162 P message:0xC02B [Registered:"SHELLHOOK"] wParam:00000004 lParam:00000000
<00010> 000100DE P message:0xC02B [Registered:"SHELLHOOK"] wParam:00000004 lParam:00000000
<00011> 000100E0 P WM_KEYUP nVirtKey:VK_LWIN cRepeat:1 ScanCode:5B fExtended:1 fAltDown:0 fRepeat:1 fUp:1 [wParam:0000005B lParam:C15B0001]
<00012> 000100E0 P WM_KEYUP nVirtKey:'T' cRepeat:1 ScanCode:14 fExtended:0 fAltDown:0 fRepeat:1 fUp:1 [wParam:00000054 lParam:C0140001]
<00013> 00010162 P message:0xC02B [Registered:"SHELLHOOK"] wParam:00000004 lParam:000C0D30
<00014> 00010502 P message:0xC02B [Registered:"SHELLHOOK"] wParam:00000004 lParam:000C0D30
<00017> 000100DE P message:0xC02B [Registered:"SHELLHOOK"] wParam:00000004 lParam:000C0D30
我的基本纯基本样本中的一个(我不是真正的开发者,但我尝试过),其中 Win + R ,用于测试(同一问题)
keys$ = "R"
handle = 0
For k = 1 To 240 ; wait 1mn max to find the taskbar
handle=FindWindow_("Shell_TrayWnd ",NULL) ; Retrieves the handle of Shell_TrayWnd class name window
If handle<>0 : Break : EndIf
Sleep_(250)
Next
If handle=0 ; Does Shell_TrayWnd class name window found?
End 1 ; Nope, so report 1 for failure to type.
Else
If IsWindow_(handle)=0 ; Does the target window actually exist?
End 1 ; Nope, so report 1 for failure to type.
Else
; This block gives the target window the focus before typing.
thread1=GetWindowThreadProcessId_(GetForegroundWindow_(),0)
thread2=GetWindowThreadProcessId_(handle,0)
If thread1<>thread2 : AttachThreadInput_(thread1,thread2,#True) : EndIf
SetForegroundWindow_(handle) ; Target window now has the focus for typing.
Sleep_(125) ; 1/8 second pause before typing to prevent fast CPU problems.
keybd_event_(#VK_LWIN,0,#KEYEVENTF_KEYUP,0) ; Release WINDOWS key before typing.
VkKey=VkKeyScanEx_(Asc(keys$),GetKeyboardLayout_(0)) ; Normal key found.
keybd_event_(#VK_LWIN,0,0,0) ; Hold WINDOWS key
keybd_event_(VkKey,0,0,0) : keybd_event_(VkKey,0,#KEYEVENTF_KEYUP,0) ; Press the normal key.
keybd_event_(#VK_LWIN,0,#KEYEVENTF_KEYUP,0) ; Release WINDOWS key
If thread1<>thread2 : AttachThreadInput_(thread1,thread2,#False) : EndIf ; Finished typing to target window!
End 0
EndIf
EndIf