求助:一段简单的代码挑错
代码是实现一个托盘工具,方便的开启和关闭node服务。当反复点击“开启”和“停止”的时候,就出现"状态无法切换"的bug了,求高手解惑。#include <Constants.au3> ;
#include <Process.au3> ;
Opt("TrayMenuMode",1)
Local $istart=TrayCreateItem ("开启")
Local $istop=TrayCreateItem ("停止")
Local $iexit=TrayCreateItem ("退出")
TraySetState(1)
While 1
Local $msg = TrayGetMsg()
Select
Case $msg = 0
ContinueLoop
Case $msg = $istart
TrayItemSetState($istop,$TRAY_UNCHECKED)
TrayItemSetState($iexit,$TRAY_UNCHECKED)
_RunDos("node D:\node\static_server.js")
MsgBox(64, "开启","NodeJS服务已开启")
Case $msg = $istop
TrayItemSetState($istart,$TRAY_UNCHECKED)
TrayItemSetState($iexit,$TRAY_UNCHECKED)
ProcessClose("node.exe")
MsgBox(64, "停止", "NodeJS服务已停止")
Case $msg = $iexit
ProcessClose("node.exe")
ExitLoop
EndSelect
WEnd
Exit
页:
[1]