Open sancarn opened 8 years ago
Another potential method for detecting MapBasic Window is with WindowInfo(,4-7), but it's not a good way.
It may also be possible to use the "WinFocusChangedHandler" but still we need a way of returning some information about the active control in MapInfo.
WindowInfo(ID,8) does not detect the MapBasic Window either.
From a Discussion with the MapInfo team: "12.5.1 is MapInfoPro 64 bit, therefore the MapBasic window is a WPF user control and does not have HWND. Wpf user control can only have HWNDSOURCE which can't be used as an HWND."
To get whether a WPF User Control is active, we may be able to use the following functions: System.Windows.Input.FocusManager.GetFocusedElement() and System.Windows.Input.Keyboard.FocusedElement()
I was hoping we would be able to grab the hWND from MapInfo using the WindowInfo() function. The MapInfo window ID for the MapBasic window is 1002.
If I do the following: print WindowInfo(1002,12) '[or WindowInfo(WIN_MAPBASIC,WIN_INFO_WND) ]
I get 0 in the Message Window, regardless of whether the window is bound to MapInfo or not.
Unfortunately also there is no specific info that we can target from AHK that would indicate the current window being the MapBasic Window. However there is the active window's text which we can get with WinGetText statement. That contains this:
If the MapBasic window is not docked to the main application however the title of the window is indicated as "MapBasic". Therefore we can say:
The question really comes down to what we do in that ...
On a more positive note the Message window is much easier to access: When docked: