creeping Posted October 5, 2006 Posted October 5, 2006 (edited) When I create a listview box there is no top to my column headingsbefore pictureBut after I resize the columns it appears. I would like the control to appear like this straight after I create it. It only appears like this In my program. When I use the help example there is a top.after pictureAny Ideas?expandcollapse popupFunc StartServicesWindow($GUI) ;x cord of toolbar control $x = 1 ;length of toolbar button icon $length = 40 ;fade out main GUI window DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $GUImain, "int", 1000, "long", 0x00090000) ;create GUI $GUIservices = GUICreate("Services", 500, 300) ;switch control to new GUI window GUISwitch($GUIservices) ;create toolbar and tooltips $iconQuery = GUICtrlCreateButton("", $x, 1, 40, 40, $BS_ICON) GUICtrlSetImage(-1, $dirIcon & "start.ico") GUICtrlSetTip(-1, "Start a service") $x += $length $iconQuery = GUICtrlCreateButton("", $x, 1, 40, 40, $BS_ICON) GUICtrlSetImage(-1, $dirIcon & "pause.ico") GUICtrlSetTip(-1, "Pause a service") $x += $length $iconstop = GUICtrlCreateButton("", $x, 1, 40, 40, $BS_ICON) GUICtrlSetImage(-1, $dirIcon & "stop.ico", -1, 2) GUICtrlSetTip(-1, "Stop a service") $x += $length $iconQuery = GUICtrlCreateButton("", $x, 1, 40, 40, $BS_ICON) GUICtrlSetImage(-1, $dirIcon & "restart.ico") GUICtrlSetTip(-1, "Restart a service") $x += $length $iconQuery = GUICtrlCreateButton("", $x, 1, 40, 40, $BS_ICON) GUICtrlSetImage(-1, $dirIcon & "query.ico") GUICtrlSetTip(-1, "Query status of a service") $x += $length $iconQuery = GUICtrlCreateButton("", $x, 1, 40, 40, $BS_ICON) GUICtrlSetImage(-1, $dirIcon & "search.ico") GUICtrlSetTip(-1, "Search for a service") $x += $length $iconQuery = GUICtrlCreateButton("", $x, 1, 40, 40, $BS_ICON) GUICtrlSetImage(-1, $dirIcon & "install.ico") GUICtrlSetTip(-1, "Install a service") $x += $length $iconQuery = GUICtrlCreateButton("", $x, 1, 40, 40, $BS_ICON) GUICtrlSetImage(-1, $dirIcon & "remove.ico") GUICtrlSetTip(-1, "Stop and remove a service") ;create listview box $lstvwComputers = GUICtrlCreateListView("Machine Name" & "|" & "IP Address", 20, 60, 205, 150, $LVS_SHOWSELALWAYS, $LVS_EX_FULLROWSELECT + $LVS_EX_GRIDLINES) ;set column widths _GUICtrlListViewSetColumnWidth($lstvwComputers, 0, 100) _GUICtrlListViewSetColumnWidth($lstvwComputers, 1, 100) EndFunc Edited October 8, 2006 by creeping
creeping Posted October 8, 2006 Author Posted October 8, 2006 Edited my post hoping maybe someone might happen to know the answer now
Moderators SmOke_N Posted October 8, 2006 Moderators Posted October 8, 2006 Edited my post hoping maybe someone might happen to know the answer nowHave a "working" example? Something we don't have to "make extra" to see your issue? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
creeping Posted October 8, 2006 Author Posted October 8, 2006 (edited) Its when I click on the services menu item does not write anything to registry, half on the functions are not used yet expandcollapse popup#include <Array.au3> #include <Constants.au3> #include <GUIConstants.au3> #Include <GuiListView.au3> ;global variables Dim $computers[1][2] $dirIcons = @ScriptDir & "\icons\" $dirTools = @ScriptDir & "\tools\" ;create main GUI window $GUImain = GUICreate("Main Menu - Remote Computer Control", 500, 300) #region menus ;file $menuFile = GUICtrlCreateMenu("&File") $menuFileExit = GUICtrlCreateMenuitem("Exit", $menuFile) ;services $menuServices = GUICtrlCreateMenu("&Services") $menuServicesShowWin = GUICtrlCreateMenuitem("Show Services Window", $menuServices) ;User account $menuUserAccounts = GUICtrlCreateMenu("&User Accounts") $menuUserAccountsShowWin = GUICtrlCreateMenuitem("Show User Accounts Window", $menuUserAccounts) ;tools $menuTools = GUICtrlCreateMenu("&Tools") $menuToolsShowWin = GUICtrlCreateMenuitem("Show Tools Window", $menuTools) ;registry $menuRegistry = GUICtrlCreateMenu("&Registry") $menuRegistryShowWin = GUICtrlCreateMenuitem("Show Registry Window", $menuRegistry) #endregion GUISetState(@SW_SHOW, $GUImain) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $menuFileExit ExitLoop Case $msg = $menuServicesShowWin StartServicesWindow($GUImain) Case $msg = $menuUserAccountsShowWin StartUserAccountsWindow($GUImain) Case $msg = $menuToolsShowWin StartUserAccountsWindow($GUImain) Case $msg = $menuRegistryShowWin StartUserAccountsWindow($GUImain) EndSelect Wend Func StartServicesWindow($GUI) ;x cord of toolbar control $x = 1 ;length of toolbar button icon $length = 40 ;fade out main GUI window DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $GUImain, "int", 1000, "long", 0x00090000) ;create GUI $GUIservices = GUICreate("Services", 500, 300) ;switch control to new GUI window $go = GUISwitch($GUIservices) ;list all services ;show service config ;set service config ;create toolbar and tooltips $iconButStart = GUICtrlCreateButton("", $x, 1, 40, 40, $BS_ICON) GUICtrlSetImage(-1, $dirIcons & "start.ico") GUICtrlSetTip(-1, "Start a service") $x += $length $iconpause = GUICtrlCreateButton("", $x, 1, 40, 40, $BS_ICON) GUICtrlSetImage(-1, $dirIcons & "pause.ico") GUICtrlSetTip(-1, "Pause a service") $x += $length $iconstop = GUICtrlCreateButton("", $x, 1, 40, 40, $BS_ICON) GUICtrlSetImage(-1, $dirIcons & "stop.ico", -1, 2) GUICtrlSetTip(-1, "Stop a service") $x += $length $iconRestart = GUICtrlCreateButton("", $x, 1, 40, 40, $BS_ICON) GUICtrlSetImage(-1, $dirIcons & "restart.ico") GUICtrlSetTip(-1, "Restart a service") $x += $length $iconQuery = GUICtrlCreateButton("", $x, 1, 40, 40, $BS_ICON) GUICtrlSetImage(-1, $dirIcons & "query.ico") GUICtrlSetTip(-1, "Query status of a service") $x += $length $iconSearch = GUICtrlCreateButton("", $x, 1, 40, 40, $BS_ICON) GUICtrlSetImage(-1, $dirIcons & "search.ico") GUICtrlSetTip(-1, "Search for a service") $x += $length $iconInstall = GUICtrlCreateButton("", $x, 1, 40, 40, $BS_ICON) GUICtrlSetImage(-1, $dirIcons & "install.ico") GUICtrlSetTip(-1, "Install a service") $x += $length $iconRemove = GUICtrlCreateButton("", $x, 1, 40, 40, $BS_ICON) GUICtrlSetImage(-1, $dirIcons & "remove.ico") GUICtrlSetTip(-1, "Stop and remove a service") ;create listview box $lstvwComputers = GUICtrlCreateListView("Machine Name" & "|" & "IP Address", 10, 50, 205, 150, $LVS_SHOWSELALWAYS, $LVS_EX_FULLROWSELECT + $LVS_EX_GRIDLINES) ;set column widths _GUICtrlListViewSetColumnWidth($lstvwComputers, 0, 100) _GUICtrlListViewSetColumnWidth($lstvwComputers, 1, 100) $font = "Lucida Console" GUISetFont(14, 400, 0, $font) GUICtrlCreateLabel("Services", 240, 53, 95, 30) $lstServices = GUICtrlCreateList("", 240, 70, 205, 150, $LBS_SORT + $LBS_NOTIFY + $WS_VSCROLL) ;$toolsIcon ;GuiCtrlCreateListViewItem("1|2", $lstvwComputers) ;fade in window DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $GUIservices, "int", 1000, "long", 0x00080000) ;activate window WinActivate($GUIservices) GetLanComputerInfo() ;LoadLstVw($lstvwComputers, $computers) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ;fade out window DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $GUIservices, "int", 1000, "long", 0x00090000) ;switch control to main GUI window GUISwitch($GUI) ;fade in main GUI window DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $GUI, "int", 1000, "long", 0x00080000) ExitLoop Case $msg = $iconButStart EndSelect Wend EndFunc Func StartUserAccountsWindow($GUI) ;fade out main GUI window DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $GUImain, "int", 1000, "long", 0x00090000) ;create GUI $GUIuserAccounts = GUICreate("User Accounts", 500, 300) ;switch control to new GUI window GUISwitch($GUIuserAccounts) ;fade in window DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $GUIuserAccounts, "int", 1000, "long", 0x00080000) ;activate window WinActivate($GUIuserAccounts) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ;fade out window DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $GUIuserAccounts, "int", 1000, "long", 0x00090000) ;switch control to main GUI window GUISwitch($GUI) ;fade in main GUI window DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $GUI, "int", 1000, "long", 0x00080000) ExitLoop EndSelect Wend EndFunc Func StartToolsWindow($GUI) ;fade out main GUI window DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $GUImain, "int", 1000, "long", 0x00090000) ;create GUI $GUItools = GUICreate("Tools", 500, 300) ;switch control to new GUI window GUISwitch($GUItools) ;fade in window DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $GUItools, "int", 1000, "long", 0x00080000) ;activate window WinActivate($GUItools) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ;fade out window DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $GUItools, "int", 1000, "long", 0x00090000) ;switch control to main GUI window GUISwitch($GUI) ;fade in main GUI window DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $GUI, "int", 1000, "long", 0x00080000) ExitLoop EndSelect Wend EndFunc Func StartRegistryWindow($GUI) ;fade out main GUI window DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $GUImain, "int", 1000, "long", 0x00090000) ;create GUI $GUIRegistry = GUICreate("Registry", 500, 300) ;switch control to new GUI window GUISwitch($GUIRegistry) ;fade in window DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $GUIRegistry, "int", 1000, "long", 0x00080000) ;activate window WinActivate($GUIRegistry) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ;fade out window DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $GUIRegistry, "int", 1000, "long", 0x00090000) ;switch control to main GUI window GUISwitch($GUI) ;fade in main GUI window DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $GUI, "int", 1000, "long", 0x00080000) ExitLoop EndSelect Wend EndFunc Func LoadServicesLstBox() $psservice = "psservice.exe " $token = "SERVICE_NAME: " $PID = Run($dirTools & $psservice & "query", @SystemDir, @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD) While 1 $line = StdoutRead($PID) If @error Then ExitLoop If StringInStr($line, $token) Then MsgBox(0, "", $line) EndIf ;MsgBox(0, "", $line) Wend EndFunc Func GetLanComputerInfo() ;net view EndFunc Func LoadLstVw($lstvwComputers, $computers) EndFunc Func NetworkAdaptorsToArray() $adaptors = "" $delim = "À" $strComputer = "." $objWMIService = ObjGet("winmgmts:" & "{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2") $colNetAdapters = $objWMIService.ExecQuery("Select * from Win32_NetworkAdapter") For $objNetAdapter in $colNetAdapters If $objNetAdapter.NetConnectionID <> "" Then $adaptors &= $objNetAdapter.NetConnectionID & $delim EndIf Next $adaptors = StringTrimRight($adaptors, StringLen($delim)) $adaptors = StringSplit($adaptors, $delim) Return $adaptors EndFunc #region OS settings Func SetWindowsFirewallStatus($status) If $status = 0 Then $status = FALSE ElseIf $status = 1 Then $status = True EndIf $objFirewall = ObjCreate("HNetCfg.FwMgr") $objPolicy = $objFirewall.LocalPolicy.CurrentProfile $objPolicy.FirewallEnabled = $status EndFunc Func ChangeSystemRestoreState($state) Opt("WinWaitDelay", 1000) $cplFile = "sysdm.cpl" $winTitle1 = "System Properties" $winTitle2 = "System Restore" $chkboxID = 1001 $applyButID = 12321 $yesButID = 6 $okButID = 1 Run(@ComSpec & " /c " & $cplFile, "", @SW_HIDE) WinWaitActive($winTitle1) Send("+^{TAB 3}") $checked = ControlCommand($winTitle1, "", $chkboxID, "IsChecked", "") If $state = 0 And $checked = 0 Then ControlCommand($winTitle1, "", $chkboxID, "Check", "") ControlClick($winTitle1, "", $applyButID) WinWaitActive($winTitle2) ControlClick($winTitle2, "", $yesButID) WinWaitActive($winTitle1) ElseIf $state = 1 And $checked = 1 Then ControlCommand($winTitle1, "", $chkboxID, "UnCheck", "") EndIf ControlClick($winTitle1, "", $okButID) Opt("WinWaitDelay", 250) EndFunc Func ChangeHibernationtState($state) Opt("WinWaitDelay", 1000) $cplFile = "powercfg.cpl" $winTitle = "Power Options Properties" $chkboxID = 1400 $checked = "" Run(@ComSpec & " /c " & $cplFile, "", @SW_HIDE) WinWaitActive($winTitle) Send("^+{TAB}") $checked = ControlCommand($winTitle, "", $chkboxID, "IsChecked", "") If $state = 0 And $checked = 1 Then ControlCommand($winTitle, "", $chkboxID, "UnCheck", "") ElseIf $state = 1 And $checked = 0 Then ControlCommand($winTitle, "", $chkboxID, "Check", "") EndIf ControlClick($winTitle, "", 1) Opt("WinWaitDelay", 250) EndFunc Func ChangeAutomaticUpdateState($state) Opt("WinWaitDelay", 1000) $cplFile = "wuaucpl.cpl" $winTitle = "Automatic Updates" $onButID = 1009 $offButID = 1007 Run(@ComSpec & " /c " & $cplFile, "", @SW_HIDE) WinWaitActive($winTitle) If $state = 0 Then ControlCommand($winTitle, "", $offButID, "Check", "") ElseIf $state = 1 Then ControlCommand($winTitle, "", $onButID, "Check", "") EndIf ControlClick($winTitle, "", 1) Opt("WinWaitDelay", 250) EndFunc #endregion Edited October 8, 2006 by creeping
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