I'm trying to set a opened window to be focused if the user tries to open a second window instead, so that only one window can be open at the same time. The problem I'm having, is that the variable I'm trying to work with doesn't appear to be a PlusWnd object, but I'm sure it is.
In one block of code, a window is created:
code:
openwnd = MsgPlus.CreateWnd("yass_gui.xml","WndConfig");
openwnd is a global variable.
Now, when this window is open and another is attempted to be opened...
code:
function OnEvent_MenuClicked(ControlId, Location, OriginWnd){
switch(ControlId){
case "settings":
if(openwnd != undefined){
Debug.Trace(typeof(openwnd));
Debug.Trace(openwnd.Handle);
Interop.Call('User32', 'SetForegroundWindow', openwnd.Handle);
return;
}
// more code ...
When this runs, I get:
code:
object
Error: unknown (code: -2147418113)
File: yass_menu.js. Line: 24.
Function OnEvent_MenuClicked returned an error. Code: -2147352567
Line 24 is the second Debug statement.
So, whats going on with the openwnd variable? And how to I set focus to it?