本帖最后由 ttexas 于 2018-9-30 19:42 编辑
照猫画虎,写了一个,用得着的拿去参考。可以根据自己的习惯修改。
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#PRE_Icon=C:\Windows\System32\SHELL32.dll
#PRE_UseX64=n
#PRE_Res_requestedExecutionLevel=None
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <APISysConstants.au3>
#include <MsgBoxConstants.au3>
#include <WinAPISys.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
Local $s_identification= '日文键盘利用程序'
If _Singleton($s_identification, 1) = 0 Then
;MsgBox(4096, "出错了", "本程序已经运行了一个实例!")
Exit
EndIf
Opt('TrayAutoPause', 0)
OnAutoItExitRegister('OnAutoItExit')
Local $hWnd = GUICreate("日文键盘利用变换/无变换/前候补")
TrayTip("日文键盘利用", "变换->空格/无变换->空格/前候补->PageUp", 2, 1)
TraySetToolTip("日文键盘利用"& @CRLF &"变换->空格" & @CRLF& "无变换->空格" & @CRLF& "前候补->PageUp"& @CRLF)
TraySetIcon("shell32.dll", -174)
GUIRegisterMsg($WM_HOTKEY, 'WM_HOTKEY')
; Set ALT-D
;_WinAPI_RegisterHotKey($hWnd, 0x0144, $MOD_ALT, 0x44);按住alt +0x44=alt+d
; Set ESC
;_WinAPI_RegisterHotKey($hWnd, 0x011B, 0, 0x1B)
_WinAPI_RegisterHotKey($hWnd, 0x011B, 0, 29) ;Set 29 无变换
_WinAPI_RegisterHotKey($hWnd, 0x011C, 0, 28) ;Set 28 变换
_WinAPI_RegisterHotKey($hWnd, 0x011D, 0, 242) ;Set VK_242,“前候补”,变换右边那个键
While 1
Sleep(1000)
WEnd
Func WM_HOTKEY($hWnd, $iMsg, $wParam, $lParam)
#forceref $hWnd, $iMsg, $wParam
Switch _WinAPI_HiWord($lParam)
Case 0x44
;MsgBox($MB_SYSTEMMODAL, '', 'You pressed ALT-D')
Case 29
ConsoleWrite( 'You pressed 无变换' & @CRLF)
Send("{SPACE}" ) ;发送空格键
Case 28
ConsoleWrite( 'You pressed 变换' & @CRLF)
Send("{ASC 032}") ;发送空格键的asc字符,效果一样的
Case 242
ConsoleWrite( 'You pressed Key242' & @CRLF)
Send("{PGUP}") ;发送pageup
EndSwitch
EndFunc ;==>WM_HOTKEY
Func OnAutoItExit()
;_WinAPI_UnregisterHotKey($hWnd, 0x0144)
_WinAPI_UnregisterHotKey($hWnd, 0x011B)
_WinAPI_UnregisterHotKey($hWnd, 0x011C)
_WinAPI_UnregisterHotKey($hWnd, 0x011D)
EndFunc ;==>OnAutoItExit
|