Elkie Posted April 20, 2007 Share Posted April 20, 2007 I create an application with Main window, Setting window and an about window. I was intended to add functions on tray menu such as Exit and about, when i try to execute the about functions it normally execute the about func and show the about window but after i close the about window, it doesn't show again when i execute from tray menu. Can somebody help me analyze what makes the problem please . Here's the part of the codes Main window script: expandcollapse popup$trayAbout=TrayCreateItem("About") TrayItemSetOnEvent(-1,"childAbout") $trayExit=TrayCreateItem("Exit") TrayItemSetOnEvent(-1,"onExit") TraySetIcon("C:\WINDOWS\system32\shell32.dll", 164) $frmMain = GUICreate("HINTS", 400, 350, -1, -1) GUISetIcon("C:\WINDOWS\system32\shell32.dll", 164) GUISetBkColor("0xf2ffd2") GUISetHelp(@ScriptDir & "\Help.chm") $grIP = GUICtrlCreateGroup("", 8, 16, 381, 125) $grIP = GUICtrlCreateGroup("", 8, 140, 381, 125) $cmdStatic = GUICtrlCreateButton("", 16, 56, 180, 75,$BS_BITMAP+$BS_FLAT) GUICtrlSetBkColor(-1,0xffffff) GUICtrlSetImage($cmdStatic,@ScriptDir & "\res\IP2STATIC.bmp") $cmdDHCP = GUICtrlCreateButton("Change IP to Dynamic", 200, 56, 180, 75, $BS_BITMAP+$BS_FLAT) GUICtrlSetImage($cmdDHCP,@ScriptDir & "\res\IP2DHCP.bmp") $cmdVPN = GUICtrlCreateButton("Change Proxy to IP-VPN", 16, 182, 180, 75,$BS_BITMAP+$BS_FLAT) GUICtrlSetImage($cmdVPN,@ScriptDir & "\res\prox2vpn.bmp") $cmdNet = GUICtrlCreateButton("Change Proxy to Internet", 200, 182, 180, 75,$BS_BITMAP+$BS_FLAT) GUICtrlSetImage($cmdNet,@ScriptDir & "\res\prox2net.bmp") $lblIPSet = GUICtrlCreateLabel("IP Settings :", 18, 31, 200, 23) GUICtrlSetFont(-1, 12, 800, 0, "Arial") $lblProxySet = GUICtrlCreateLabel("IP-VPN :", 16, 150, 200, 23) GUICtrlSetFont(-1, 12, 800, 0, "Arial") GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlSetData(-1, 100) GUICtrlSetColor(-1, 0xFF0000) GUICtrlSetBkColor(-1, 0xFFFBF0) $lblVer = GUICtrlCreateLabel("Version 1.0", 15, 272, 150, 17) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") $MenuItem1 = GUICtrlCreateMenu("&File") $MenuItem2 = GUICtrlCreateMenu("&Help") $mnCfg = GUICtrlCreateMenuitem("Settings", $MenuItem1) $mnExit= GUICtrlCreateMenuitem("Exit", $MenuItem1) $mnHelp= GUICtrlCreateMenuitem("Help", $MenuItem2) $mnAbout = GUICtrlCreateMenuitem("About",$MenuItem2) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### WinSetOnTop("IP Switcher ©±", "", 1) Func OnAutoITStart() If Not FileExists("hppmCon.ini") Then MsgBox(0, "Error", "Configuration file is missing, program will be closed") Exit EndIf EndFunc ;==>OnAutoITStart GUICtrlSetData($lblIPSet, Call("MainGetStatus", "ip")) GUICtrlSetData($lblProxySet, Call("MainGetStatus", "proxy")) Call("Main") Func Main() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE ;WinSetOnTop("IP Switcher","",0) Call("onExit") Case $GUI_EVENT_MINIMIZE Case $cmdStatic Call("OnStatic") Case $cmdDHCP Call("OnDHCP") Case $cmdVPN Call("OnVPN") ;Case $cmdNet ; Call("onNet") Case $mnExit Call("OnExit") Case $mnHelp ShellExecute("Help.chm") Case $mnAbout Call("ChildAbout") GUISwitch($frmMain) Case $mnCfg ;WinSetOnTop("IP Switcher","",0) Call("ChildActive") GUISwitch($frmMain) EndSwitch WEnd EndFunc ;==>Main The About window script: Func ChildAbout() $frmAbout = GUICreate("About", 272, 173, 424, 337, $WS_CAPTION, $WS_EX_TOOLWINDOW, $frmMain) GUISetBkColor("0xd8eda5") GUISetIcon("C:\WINDOWS\system32\shell32.dll", 90) $Label1 = GUICtrlCreateLabel("H.I.N.T.S", 0, 20, 257, 50,$SS_CENTER) GUICtrlSetFont($Label1,16,800) GUICtrlSetColor($Label1,"0x0033f1") $Label2 = GUICtrlCreateLabel("Honda Internet and Network Transition Software" & Chr(13) & Chr(13) & "(c)2007 HPPM IT Department", 0, 45, 257, 50,$SS_CENTER) GUICtrlSetColor($Label2,"0x0066FF") $cmdOk = GUICtrlCreateButton("&Ok", 70, 100, 125, 40,0) GUISetState(@SW_SHOW) WinSetOnTop("About", "", 1) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUIDelete($frmAbout) Call("Main") Case $cmdOk GUIDelete($frmAbout) GUISwitch($frmMain) WinSetOnTop("HINTS", "", 1) Call("Main") EndSwitch WEnd EndFunc ; Func onExit() Exit EndFunc ;==>onExit Link to comment Share on other sites More sharing options...
Elkie Posted April 20, 2007 Author Share Posted April 20, 2007 NVM Guys, some of my experiments works. My fault to not put in the loop. case closed!!! Sorry Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now