Store the WindowIds in an object and on Destroy delete them and when you need to check if they are open iterate through the object and see if they exist.
Javascript code:
var objWindows = {};
function OpenWindow(Name, XML, ShowCode){
if (typeof objWindows[Name] === 'object' && typeof objWindows[Name].Handle === 'number' && Interop.Call('user32', 'IsWindow', objWindows[Name].Handle) {
Interop.Call('user32', 'SetForegroundWindow', objWindows[Name].Handle);
return objWindows[Name];
}
if (typeof(ShowCode) === 'undefined') ShowCode = 0;
objWindows[Name] = MsgPlus.CreateWnd(XML, Name, ShowCode);
return objWindows[Name];
}
function CheckIfWindowExists ( Name ) {
for ( objWindow in objWindows ) {
if ( objWindow === Name ) return true;
}
return false;
}
function OnWindowIdEvent_Destroyed(pPlusWnd) {
delete objWindows[pPlusWnd.WindowId];
}
Something along those lines