#include #include #include #include global $g_MainGUI, $g_MemGUI, $g_MemDisplay HotKeySet("{F11}", ShowConfigGUI) Main() ; ---------------------------------------------------------------------- func Main() Opt("TrayAutoPause", 0) Opt("TrayOnEventMode", 1) CreateTrayMenu() $g_MainGUI = GUICreate('parent') GuiSetState(@SW_HIDE) DisplayMemoryUsage() while True sleep(250) wend endfunc ; ---------------------------------------------------------------------- func CreateTrayMenu() Opt("TrayMenuMode", 3) $tray_config = TrayCreateItem("Configure") TrayItemSetOnEvent($tray_config, ShowConfigGUI) $tray_exit = TrayCreateItem("Exit") TrayItemSetOnEvent(-1, _Exit) endfunc ; ---------------------------------------------------------------------- func DisplayMemoryUsage() $style = BitOR($WS_POPUP, $WS_BORDER) global $g_MemGUI = GUICreate("", 80, 40, (@DesktopWidth - 80 - 2), 0, $style) GUISetState(@SW_SHOW, $g_MemGUI) $g_MemDisplay = GUICtrlCreateLabel("", 10, 10, 60, 20) AdlibRegister("UpdateMemoryUsage", 1000) endfunc ; ---------------------------------------------------------------------- func UpdateMemoryUsage($hWnd, $iMsg, $iIDTimer, $iTime) ConsoleWrite('Update ' & @sec & @CRLF) $a = ProcessGetStats(-1, $PROCESS_STATS_MEMORY) $mem = ($a[0] / (1024 * 1024)) GUICtrlSetData($g_MemDisplay, StringFormat("%.1f Mb", $mem)) endfunc ; ---------------------------------------------------------------------- func ShowConfigGUI() while CreateConfigGUI($g_MainGUI) ; wend endfunc ; ---------------------------------------------------------------------- func _Exit() Exit endfunc ; ---------------------------------------------------------------------- func CreateConfigGUI($parent = 0) Opt("GUIResizeMode", $GUI_DOCKALL) $g_ConfigGUI = GUICreate("Configuration", 400, 300, -1, -1) GUISetState(@SW_SHOW, $g_ConfigGUI) MainMsgLoop() GUIDelete($g_ConfigGUI) endfunc ; ---------------------------------------------------------------------- func MainMsgLoop() while True $msg = GuiGetMsg() select case ($msg = $GUI_EVENT_CLOSE) exitloop endselect wend endfunc