Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Two problems with my first app

$
0
0

Hi,

My first problem is not work gui "Settings" after select in system tray icon and the second problem is how to combine left click and right click with diferent menus.
Sorry for my english!!! :sweating:
By the By, I am newbie in AutoIt

AutoIt         
#include <GUIConstantsEx.au3> #NoTrayIcon Opt("TrayMenuMode", 1) TraySetClick(16) ; Only click right TraySetIcon("shell32.dll", -28) Local $About = TrayCreateItem("About") Local $MenuSettings = TrayCreateItem("Settings") Local $MenuShutdownExit = TrayCreateItem("Exit") TraySetState() While 1     Local $msg = TrayGetMsg()     Select         Case $msg = 0             ContinueLoop         Case $msg = $About             MsgBox(0, "About", "Create by 23r9i0")             TrayItemSetState($About, $TRAY_UNCHECKED)          Case $msg = $MenuSettings             _GetSettings()             TrayItemSetState($MenuSettings, $TRAY_UNCHECKED)         Case $msg = $MenuShutdownExit             Exit     EndSelect WEnd Exit Func _GetSettings()     $GUISettings = GUICreate("Settings", 400, 300)     $MenuSettings = GUICtrlCreateMenu("Menu")     $MenuSettingsRestore = GUICtrlCreateMenuItem("Restore", $MenuSettings)     $MenuSettingsExit = GUICtrlCreateMenuItem("Exit", $MenuSettings)     GUISetBkColor(0xFFFFFF)     $GUIGroupCheckboxes = GUICtrlCreateGroup("Active or Deactive Shourtcut", 20, 20, 360, 190)     Local $Checkboxes[10][2]     $Checkboxes[0][1] = "Abort"     $Checkboxes[1][1] = "Boot Options"     $Checkboxes[2][1] = "Hybrid Shutdown"     $Checkboxes[3][1] = "Shutdown"     $Checkboxes[4][1] = "Restart"     $Checkboxes[5][1] = "Hibernate"     $Checkboxes[6][1] = "Sleep"     $Checkboxes[7][1] = "Switch User"     $Checkboxes[8][1] = "Sign Out"     $Checkboxes[9][1] = "Lock"     $TopPosition = 50     $LeftPosition = 40     For $i = 0 To UBound($Checkboxes, 1) - 1         $Checkboxes[$i][0] = GUICtrlCreateCheckbox($Checkboxes[$i][1], $LeftPosition, $TopPosition, 160, 20)         $TopPosition += 30         If $i > 3 Then             $LeftPosition = 210         EndIf         If $i = 4 Then             $TopPosition = 50         EndIf     Next     GUICtrlCreateGroup("", -99, -99, 1, 1)     $SaveButton = GUICtrlCreateButton("Save", 20, 230, 75, 30)     $CancelButton = GUICtrlCreateButton("Cancel", 120, 230, 75, 30)     $HelpButton = GUICtrlCreateButton("Help", 305, 230, 75, 30)     GUISetState(@SW_SHOW, $GUISettings)     While 1         $GUIMsg = GUIGetMsg()         Select             Case $GUIMsg = $MenuSettingsRestore                Exit; undefined options             Case $GUIMsg = $MenuSettingsExit                 GUISetState( @SW_HIDE, $GUISettings )             Case $GUIMsg = $SaveButton                 For $i = 0 To UBound($Checkboxes, 1) - 1                     If BitAND(GUICtrlRead($Checkboxes[$i][0]), $GUI_CHECKED) = $GUI_CHECKED Then                         RegWrite("HKEY_CURRENT_USER\Software\Menu Shutdown", $Checkboxes[$i][1], "REG_SZ", "1")                     Else                         RegWrite("HKEY_CURRENT_USER\Software\Menu Shutdown", $Checkboxes[$i][1], "REG_SZ", "0")                     EndIf                 Next                 GUISetState( @SW_HIDE, $GUISettings )             Case $GUIMsg = $CancelButton                 GUISetState( @SW_HIDE, $GUISettings )             Case $GUIMsg = $HelpButton                 MsgBox(0, "Help", "test help")      Case $GUIMsg = $GUI_EVENT_CLOSE         GUIDelete( $GUISettings )         EndSelect     WEnd EndFunc

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>