Page 1 of 1

Press Ctrl+V in non AHK GUI brings up "ListVars" window

Posted: 17 Sep 2017, 23:24
by tmplinshi

Code: Select all

DllCall("LoadLibrary", "Str", "XCGUI.dll", "Ptr")
DllCall("XCGUI\XInitXCGUI", "str", "")
hWindow := DllCall("XCGUI\XWnd_Create", "int", 0, "int", 0, "int", 300, "int", 200, "int", "XCGUI", "int", 0, "int", 15)
DllCall("XCGUI\XShapeText_Create", "int", 50, "int", 100, "int", "200", "int", 50, "str", "Press Ctrl+V in this window", "int", hWindow)
DllCall("XCGUI\XWnd_ShowWindow", "int", hWindow, "int", 5)
Return

Esc::ExitApp
The above code will create a simple window, but pressing Ctrl+V brings up the ListVars window.. So confused.. but then I saw the hotkey in the menu:
CtrlV.png
CtrlV.png (8.2 KiB) Viewed 595 times
So can we limit Ctrl+V inside this window only?

Download: CtrlV-Test.7z

Re: Press Ctrl+V in non AHK GUI brings up "ListVars" window

Posted: 18 Sep 2017, 11:53
by TheDewd
The other hotkeys are affected too, of course.

Interesting that it doesn't happen using example "Example01 - Window.ahk" from your library at https://autohotkey.com/boards/viewtopic.php?t=9201

Re: Press Ctrl+V in non AHK GUI brings up "ListVars" window

Posted: 18 Sep 2017, 12:17
by tmplinshi
Adding XRunXCGUI can fix the issue: (which the example you mentioned have it)

Code: Select all

...
DllCall("XCGUI\XWnd_ShowWindow", "int", hWindow, "int", 5)

DllCall("XCGUI\XRunXCGUI") ; Wait until there is not XCGUI window
DllCall("XCGUI\XExitXCGUI") ; Cleanup
MsgBox, Exitting
ExitApp
However still I hope the bug can be fixed.

Re: Press Ctrl+V in non AHK GUI brings up "ListVars" window

Posted: 20 Sep 2017, 09:01
by just me
AFAICS, you create a non-GUI window AHK doesn't know anything about. For some reason, the keyboard input is passed to the script's (hiddden) main window. How should AHK prevent it?

Re: Press Ctrl+V in non AHK GUI brings up "ListVars" window

Posted: 20 Sep 2017, 11:38
by tmplinshi
I think checking whether the hidden main window is shown and active is enough.

Re: Press Ctrl+V in non AHK GUI brings up "ListVars" window

Posted: 26 Nov 2017, 23:09
by lexikos
Those keyboard shortcuts are implemented with the standard TranslateAccelerator system function; i.e. the function is responsible for consuming only the appropriate messages. It evidently does so correctly for every other window, so I can't see this being an AutoHotkey bug. I'm not inclined to work around a bug in a third party library.

It may be interesting to see whether the messages are actually being sent to the script's main window.