|
|||
|
What does my desktop application/projector do? It starts up, displays itself on the screen for a second, then gets minimized to the system tray.
After x seconds (or minutes), it pops up with a reminder message. After y seconds, it gets minimized to the system tray again. And so on, and so forth. Until the end user closes the application or turns off the computer. The problem: After showing & hiding & showing & hiding a few times, I get a nasty Windows XP bug message, asking me whether I want to send the issue to Microsoft. Does anybody see anything alarming in my code? Any suggestions for improvement? Your help would be greatly appreciated! Code:
//Initialize
getAdditionalFile();
gmw = getMainWnd();
timeToHide = 10000;
timeToShow = 10000;
ft = 1;
gmw.onSize = function (type, w, h) {
if (type == 1/*minimized*/) {
gmw.hide();
}
}
Application.Behaviour.bShowInSystemTray = true;
Application.SysTray.useDefaultHandler = false;
Application.SysTray.tip = "Visual Health Tool";
Application.SysTray.add();
Application.SysTray.onRClicked = function (){
var menu = new Menu;
menu.createPopupMenu();
menu.appendItem("id0", "Hide");
menu.appendItem("id1", "Show");
menu.appendItem();
menu.appendItem("id2", "About");
menu.appendItem();
menu.appendItem("id3", "Exit");
gmw.bringToTop();
var id = menu.show();
if(id == "id0"){
gmw.hide();
}
if(id == "id1"){
if(gmw.windowState == "minimized"){
gmw.windowState = "normal";
}
gmw.show();
gmw.bringToTop();
}
if(id == "id2"){
}
if(id == "id3"){
gmw.close();
}
}
/* GLOBAL VARIABLES TO HIDE & SHOW THE APPLICATION * * * * * * * * * * * * * * */
//tt = 25000;
//timerShow = Application.setInterval(ShowApp, tt, (new Date).toString());
function ShowApp(str){
Application.clearInterval(timerShow);
if(gmw.windowState == "minimized"){
gmw.windowState = "normal";
}
gmw.bringToTop();
gmw.show();
timerHide = Application.setInterval(HideApp, 5000, "hide");
}
function HideApp(str){
Application.clearInterval(timerHide);
if(gmw.windowState != "minimized"){
gmw.windowState = "minimized";
}
gmw.hide();
// Dialogs.msgBox("Hidden");
timerShow = Application.setInterval(ShowApp, 10000, "show");
}
/* ONLY ALLOW ONE INSTANCE OF THIS APPLICATION * * * * * * * * * * * * * * * * * * * */
wnds = Window.getWindowsByName("Visual Health Tool");
var has = false;
for (i = 0; i < wnds.length; i++){
if (wnds[i].handle != gmw.handle){
has = true;
break;
}
}
if(has){
wnds[i].bringToTop();
return false;
}
if(ft == 1){
ft++;
timerHide = Application.setInterval(HideApp, 1000, "hide");
}
return true;
|
![]() |
Was this information helpful? Yes No
| Thread Tools | |
| Display Modes | |
|
|