CtrlSSMS (SQL Server Management Studio) では、タブを中クリックするか、 +を押しF4て現在のエディター タブを閉じる必要があります。Autoit
ショートカットを作成するために使用したいCtrl+w同じことをします。しかし、私はそれに問題があります。以下はコードです。私が考えたのは、ユーザーがCtrl+wを押したときに、ユーザーが にいるかどうかを確認しSSMS
、そうであればCtrl+を送信F4して現在のタブを閉じ、そうでない場合はCtrl+wを送信して通常どおりに行かせることです。ただ、ポイントはCtrl+を送るwと再度 Autoit に取り込まれてしまうので、デッドループが発生します。この問題を解決する方法が見つかりません。誰でも私を助けることができますか?
ありがとう。
HotKeySet("^w", "close_ssms_editor")
While 1
Sleep(200)
WEnd
; using Ctrl + w to close
; * editors in SSMS
; * editors in SSMS through Royal TS
Func close_ssms_editor()
$window_class_name = get_window_class_name(WinGetHandle(""))
If $window_class_name = "wndclass_desked_gsk" or $window_class_name = "WindowsForms10.Window.8.app.0.218f99c" Then
Send("^{F4}")
Else
Send("^w")
EndIf
EndFunc
Func get_window_class_name($nCtrl)
If Not IsHWnd($nCtrl) then $nCtrl = HWnd($nCtrl)
Local $struct = DllStructCreate("char[128]"),$classname = 0
$ret = DllCall("user32.dll","int","GetClassName","hwnd",$nCtrl,"ptr",DllStructGetPtr($struct),"int",DllStructGetSize($struct))
If IsArray($ret) Then
$classname = DllStructGetData($struct,1)
While (StringIsDigit(StringRight($classname,1)))
$classname = StringTrimRight($classname,1)
WEnd
EndIf
$struct =0
Return $classname
EndFunc