小屏幕键盘,有请大虾完善,谢谢 [已解决]
本帖最后由 奥斯丁 于 2010-7-28 10:29 编辑小屏幕键盘,搞多天了,查了n多资料,无奈太菜,有请大虾完善,谢谢
#include <GUIConstantsEx.au3>
#Include <WinAPI.au3>
;~ _WinAPI_EnumWindows([$fVisible = True])
Opt('MustDeclareVars', 1)
Example()
Func Example()
Local $parent1, $ok1, $cancel1
Opt("GUICoordMode", 2)
Opt("GUIResizeMode", 1)
Opt("GUIOnEventMode", 1)
$parent1 = GUICreate("Parent1")
GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "SpecialEvents")
GUISetOnEvent($GUI_EVENT_RESTORE, "SpecialEvents")
GUISetState()
;~ 置顶前先取到当前激活窗口,这个程序置顶以后再把原来的窗口激活。
$ok1 = GUICtrlCreateButton("1", 10, 30, 50)
GUICtrlSetOnEvent(-1, "OKPressed")
$cancel1 = GUICtrlCreateButton("2", 0, -1)
GUICtrlSetOnEvent(-1, "CancelPressed")
;~ GUISetState(@SW_SHOW)
WinSetOnTop($parent1, "", 1)
GUISetState(@SW_SHOWNOACTIVATE,$parent1)
; Just idle around
While 1
;~ _WinAPI_EnumWindows([$fVisible = True])
Sleep(100)
WEnd
EndFunc ;==>Example
Func OKPressed()
Send('1')
_WinAPI_GetForegroundWindow()
msgbox(0, '前台激活窗口标题:', WinGetTitle(_WinAPI_GetForegroundWindow()))
;~ MsgBox(0, "OK Pressed", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle & " CtrlHandle=" & @GUI_CtrlHandle,1)
EndFunc ;==>OKPressed
Func CancelPressed()
Send('2')
MsgBox(0, "Cancel Pressed", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle & " CtrlHandle=" & @GUI_CtrlHandle)
EndFunc ;==>CancelPressed
Func SpecialEvents()
Select
Case @GUI_CtrlId = $GUI_EVENT_CLOSE
MsgBox(0, "Close Pressed", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)
Exit
Case @GUI_CtrlId = $GUI_EVENT_MINIMIZE
MsgBox(0, "Window Minimized", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)
Case @GUI_CtrlId = $GUI_EVENT_RESTORE
MsgBox(0, "Window Restored", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)
EndSelect
EndFunc ;==>SpecialEvents 靠,怎嚜處理FN鍵?
靠,怎嚜處理FN鍵? 谢兄弟的关注, 我只想要小键盘和方向键及翻页键的,可以的话加个组合键,一键代表某个按键组合, fn键没有考虑。
本来windows自带的屏幕键盘也可用,只是打开后太大把屏幕都挡着了,不合用。
现在的问题是:
1 . 小键盘置顶后,置顶前先取到当前激活窗口,这个程序置顶以后再把原来的窗口激活。焦点不能到目标位置发生作用,按下去反映的是小键盘被激活为当前窗口,晕。
2.按键发送命令搞不懂。
整理一下, 希望高手帮忙
#include <GUIConstantsEx.au3>
#Include <WinAPI.au3>
;~ _WinAPI_EnumWindows([$fVisible = True])
Opt('MustDeclareVars', 1)
Example()
Func Example()
Local $parent1, $ok1, $cancel1
Opt("GUICoordMode", 2)
Opt("GUIResizeMode", 1)
Opt("GUIOnEventMode", 1)
$parent1 = GUICreate("Parent1")
GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "SpecialEvents")
GUISetOnEvent($GUI_EVENT_RESTORE, "SpecialEvents")
GUISetState()
;~ 置顶前先取到当前激活窗口,这个程序置顶以后再把原来的窗口激活。
$ok1 = GUICtrlCreateButton("1", 10, 30, 50)
GUICtrlSetOnEvent(-1, "OKPressed")
$cancel1 = GUICtrlCreateButton("2", 0, -1)
GUICtrlSetOnEvent(-1, "CancelPressed")
;~ GUISetState(@SW_SHOW)
WinSetOnTop($parent1, "", 1)
GUISetState(@SW_SHOWNOACTIVATE,$parent1)
; Just idle around
While 1
;~ _WinAPI_EnumWindows([$fVisible = True])
Sleep(100)
WEnd
EndFunc ;==>Example
Func OKPressed()
Send('1')
_WinAPI_GetForegroundWindow()
msgbox(0, '前台激活窗口标题:', WinGetTitle(_WinAPI_GetForegroundWindow()))
EndFunc ;==>OKPressed
Func CancelPressed()
Send('2')
;~ MsgBox(0, "Cancel Pressed", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle & " CtrlHandle=" & @GUI_CtrlHandle)
EndFunc ;==>CancelPressed
MsgBox(0, "Cancel Pressed", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle & " CtrlHandle=" & @GUI_CtrlHandle)
EndFunc ;==>CancelPressed
Func SpecialEvents()
@GUI_CtrlId = $GUI_EVENT_CLOSE
Exit
EndFunc 本帖最后由 afan 于 2010-7-25 23:21 编辑
关键是输入时会在小键盘窗口和目标窗口之间来回激活窗口,这个不爽 完美解决。
http://www.autoitx.com/forum.php?mod=viewthread&tid=17127&extra=&page=1 如何编辑主题.把分类改为[已解决] ,晕 回复 6# 奥斯丁
早就没有此分类了,在标题上加几个字即可 A版帮忙看看, 还有点小问题 ....(在您的帖子里)
页:
[1]