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

Report problems with documented functionality
tmplinshi
Posts: 1261
Joined: 01 Oct 2013, 14:57

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

Post by tmplinshi » 17 Sep 2017, 23:24

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 558 times
So can we limit Ctrl+V inside this window only?

Download: CtrlV-Test.7z
User avatar
TheDewd
Posts: 1092
Joined: 19 Dec 2013, 11:16
Location: USA

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

Post by TheDewd » 18 Sep 2017, 11:53

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
Image Bulldozer - Sokoban inspired game from 1994 recreated in AutoHotkey.
tmplinshi
Posts: 1261
Joined: 01 Oct 2013, 14:57

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

Post by tmplinshi » 18 Sep 2017, 12:17

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.
just me
Posts: 5510
Joined: 02 Oct 2013, 08:51
Location: Germany

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

Post by just me » 20 Sep 2017, 09:01

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?
tmplinshi
Posts: 1261
Joined: 01 Oct 2013, 14:57

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

Post by tmplinshi » 20 Sep 2017, 11:38

I think checking whether the hidden main window is shown and active is enough.
lexikos
Posts: 6175
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

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

Post by lexikos » 26 Nov 2017, 23:09

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.
Post Reply

Return to “Bug Reports”