Leaderboard
Popular Content
Showing content with the highest reputation on 03/24/2013 in all areas
-
Hi, Here is a TreeView GUI with some functionalities (search, export to clipboard, change state of the tree...). Personally I use it to display some datas from the registry. Tested with : AutoIt 3.3.0.0, WinXP SP3 32 Bits, single monitor, 'Windows classic' (as Windows 95/98/2000) desktop theme I would be grateful if someone would be willing to test it in different environments than mine to see how it behaves. Things that could make the script not to work properly : * using an AutoIt script engine > 3.3.0.0 (However, I tried to make my script compatible with newer AutoIt versions) * running on another OS than WinXP * running on a 64 Bits OS (DllStruct or DllCall possible issues with 64 bits pointers/handles) * GUI problems with desktop themes (I only use the 'Windows classic' theme) * multiple monitors (for windows positionning, treeview items hit_test and rectangle) * things I did not think of... * and bugs of course... Known bugs : * memory usage increase by a few hundreds Kbytes everytime the treeview is reloaded (some memory leak...), as a workaround, after a hundred treeview reload, the program will restart itself to release the lost memory * small memory leak (~8 kb) on each tree reload * using a theme for the blinds with large fonts makes the bottom of the main GUI to disappear The code is free to reuse/improve/adapt as you want. (This script, as I release it, does not write anything to the registry or the file system) Thanks for any testing or advice. Updated, 02 April 2013 : TreeViewGUI.zip : MD5 : DF0802EE21D458AA00DA839B235370BB SHA-1 : 3FF545F440E728B86D1688C56CF7FB3060DEB4EA SHA-256 : 0D24C6D24808BE34EB8BC2A92218D6EB7B8209DF1B0AED6CB78943633814E320 TreeViewGUI.zip screenshots :1 point
-
Both issues have been fixed. I will update in the next couple of days.1 point
-
I - and I'm sure that's true for the rest of us - are glad to be of service1 point
-
Just disable this and your code will be ok. For the regex just wait a minute that i will look in the source code Hi!1 point
-
Change icon ...
ahmeddzcom reacted to FireFox for a topic
I would completely ignore you since you are asking in an impolite way... but there is still some gentle people here. This is not a "do it for me" forum. You need to show what you've already done by mainly posting a snippet. Br, FireFox.1 point -
Well, here's something anyway. You need to redraw everything on WM_PAINT. I've added some things too, like double buffering. But the biggest thing is to only actually draw what is visible. You'll need to determine that for real, as mine is only an example. Scrolling still kinda sucks though... you might be better served trying to create the grid in a ListView, and using some custom color UDFs to color the cells. ; ============================================================================================================================== ; ; Program Name: OMNiViewer ; ; AutoIt Version: 3.3.8.1 ; Language: English ; Platform: Win9x/NT ; Author: JP Spampinato (jpspampinato@yahoo.com) ; $version = "OMNiViewer 0.2a" ; ============================================================================================================================== #region Includes, Variables #include <Date.au3> #include <GuiTab.au3> #include <Timers.au3> #include <Excel.au3> #include <GuiScrollBars.au3> #include <GUIScrollbars_Ex.au3> #include <ScrollBarConstants.au3> #include <Constants.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <GUIConstantsEx.au3> #include <ColorConstants.au3> #include <StaticConstants.au3> #include <StringSize.au3> #include <GDIPlus.au3> Opt('MustDeclareVars', 1) Opt("GUICloseOnEsc", 0) OnAutoItExitRegister("_FontCleanUp") Global $ahFontEx[1] = [0] Global $TabMainControl, $TabOperations, $TabTriggers, $TabReporting, $sTabNowDisplaying Global $MenuFile, $MenuFileOpen, $MenuFileLoadLoginIDs, $MenuFileLoadSave, $MenuFileExit Global $MenuView, $MenuViewDocking, $MenuViewDockingDocked, $MenuViewDockingSideSide, $MenuViewDockingTopBot, $MenuViewStatusbar Global $MenuHelp, $MenuHelpAbout, $MenuHelpOMNi, $MenuHelpReleaseNotes Global $EditLogWindow Global $ButtonStampLog Global $LabelStatusMain, $LabelStatusDest Global $sStatusMessageMain = " Ready", $sStatusMessageDest = " Ready" Global $stylesStatusbar = BitOR($SS_SIMPLE, $SS_SUNKEN), $stylesDestinationWindow = BitOR($WS_POPUP, $WS_CAPTION) Global $Run = 0, $Dock = 1, $Dock_Location = 1, $msg, $x1, $x2, $y1, $y2 ; for the Docking() group of functions Global $internalLabelID1, $internalLabelID2 Global $oExcel = 0, $sFile Global $sSourceDirecory = "\\Desktop\OMNi\" ; why are we running out of resources? can't create the logging GUI if we add too many Skillsets ? Global $dIntervalDateSetup = _NowCalcDate() & " 00:00:00" Global $hMainWindow, $hDestinationWindow, $hFlexGrid, $hIntervalsColumn, $hSkillsetsRow Global $intervalRowCount = 48, $intervalColumnCount = 1, $skillsetRowCount = 1, $skillsetColumnCount = 45 Global $countGridLabels = 0, $countIntervalLabels = 0, $countSkillsetLabels = 0, $countOtherLabels = 0, $totalLabels = 0, $countExtraLabel1 = 0 Global $cellWidth = 30, $cellHeight = 20, $penWeight = 1, $penColor Global $cellLeftOffset = 8, $cellTopOffset = 8, $barThickness = 20 Global $heightMain = 720, $widthMain = 1280 Global $mainLeftOffset = 100, $mainTopOffset = 100 Global $heightDest = 720, $widthDest = 320 Global $heightFlexGrid = 560, $widthFlexGrid = 1000 Global $flexLeftOffset = $widthMain - $widthFlexGrid - $barThickness + 8, $flexTopOffset = $heightMain - $heightFlexGrid - ($barThickness * 2) - 8 Global $heightIntervals = $heightFlexGrid, $widthIntervals = ($cellWidth * 2) + 2 Global $intervalsLeftOffset = $flexLeftOffset - ($barThickness * 2) - 2, $intervalsTopOffset = $flexTopOffset Global $heightSkillsets = $cellHeight * 5, $widthSkillsets = $widthFlexGrid Global $skillsetsLeftOffset = $flexLeftOffset, $skillsetsTopOffset = $flexTopOffset - ($barThickness * 4) - 2 Global $heightFlexScrollbar = $intervalRowCount * ($cellHeight + 8), $widthFlexScrollbar = $skillsetColumnCount * ($cellWidth + 8) Global $gridCellsContent[$intervalRowCount][$skillsetColumnCount], $tempGrid[1][1], $tempSkillsetContent[1][1] Global $otherLabel1, $otherLabel2, $otherLabel3, $otherLabel4, $otherLabel5, $otherLabel6, $tempScroll1, $tempScroll2 Global $tempLabel1, $tempLabel2, $tempLabel3, $tempLabel4, $tempLabel5, $tempLabel6, $tempExtraLabel1 Global $tempMeasurements1, $tempMeasurements2, $tempMeasurements3, $tempMeasurements4 Global $tempMeasurements5, $tempMeasurements6, $tempMeasurements7, $tempMeasurements8 Global $tempMeasurements9, $tempMeasurements10, $tempMeasurements11, $tempMeasurements12 ; why are we running out of resources? can't create the logging GUI if we add too many Skillsets ? #endregion Includes, Variables #region Setup GUI, Menus, Tabs, and Grid Definitions $hMainWindow = GUICreate($version, $widthMain, $heightMain, $mainLeftOffset, $mainTopOffset) #region Setup Menus $MenuFile = GUICtrlCreateMenu("&File") $MenuFileOpen = GUICtrlCreateMenuItem("Open...", $MenuFile) GUICtrlSetState(-1, $GUI_DEFBUTTON) GUICtrlCreateMenuItem("", $MenuFile) $MenuFileLoadLoginIDs = GUICtrlCreateMenuItem("Load LoginID data for all agents", $MenuFile) GUICtrlCreateMenuItem("", $MenuFile) $MenuFileLoadSave = GUICtrlCreateMenuItem("Save", $MenuFile) GUICtrlSetState(-1, $GUI_DISABLE) $MenuFileExit = GUICtrlCreateMenuItem("Exit", $MenuFile) $MenuView = GUICtrlCreateMenu("&View") $MenuViewDocking = GUICtrlCreateMenu("Docking", $MenuView) $MenuViewDockingDocked = GUICtrlCreateMenuItem("Docked", $MenuViewDocking) GUICtrlCreateMenuItem("", $MenuViewDocking) $MenuViewDockingSideSide = GUICtrlCreateMenuItem("Side By Side", $MenuViewDocking) $MenuViewDockingTopBot = GUICtrlCreateMenuItem("Top And Bottom", $MenuViewDocking) GUICtrlSetState($MenuViewDockingDocked, $GUI_CHECKED) GUICtrlSetState($MenuViewDockingSideSide, $GUI_CHECKED) GUICtrlCreateMenuItem("", $MenuView) $MenuViewStatusbar = GUICtrlCreateMenuItem("Statusbar", $MenuView) GUICtrlSetState(-1, $GUI_CHECKED) $MenuHelp = GUICtrlCreateMenu("&Help") $MenuHelpOMNi = GUICtrlCreateMenuItem("Usage", $MenuHelp) $MenuHelpReleaseNotes = GUICtrlCreateMenuItem("Release Notes", $MenuHelp) GUICtrlCreateMenuItem("", $MenuHelp) $MenuHelpAbout = GUICtrlCreateMenuItem("About " & $version, $MenuHelp) $LabelStatusMain = GUICtrlCreateLabel($sStatusMessageMain, 0, $heightMain - 36, $widthMain, 16, $stylesStatusbar) GUICtrlSetBkColor(-1, 0x80ff80) GUICtrlSetState($LabelStatusMain, $GUI_SHOW) #endregion Setup Menus #region Setup Tabs $TabMainControl = GUICtrlCreateTab(2, 2, $widthMain - 4, $heightMain - 20 - 20) $TabOperations = GUICtrlCreateTabItem("Operational Grid") _tempOperationsLabels() $TabTriggers = GUICtrlCreateTabItem("Triggers") _tempTriggersLabels() $TabReporting = GUICtrlCreateTabItem("Reporting") GUICtrlCreateTabItem("") GUISetState(@SW_SHOW, $hMainWindow) #endregion Setup Tabs #region GDIPlus _GDIPlus_Startup() #endregion #region Setup Flex Grid GUISwitch($hMainWindow, $TabOperations) $hFlexGrid = GUICreate("", $widthFlexGrid, $heightFlexGrid, $flexLeftOffset, $flexTopOffset, $WS_POPUP, $WS_EX_MDICHILD, $hMainWindow) GUISetBkColor($COLOR_SILVER, $hFlexGrid) _GUIScrollbars_Generate($hFlexGrid, $widthFlexScrollbar + $barThickness + $skillsetColumnCount, $heightFlexScrollbar + $barThickness + $intervalRowCount, True) GUISetState(@SW_SHOW, $hFlexGrid) Global Const $hPen_COLORRED = _GDIPlus_PenCreate(BitOR(0xFF000000, $COLOR_RED)) Global Const $hPen_COLORWHITE = _GDIPlus_PenCreate(BitOR(0xFF000000, $COLOR_WHITE)) Global Const $hPen_COLORGREEN = _GDIPlus_PenCreate(BitOR(0xFF000000, $COLOR_GREEN)) Global Const $hPen_COLORMEDGRAY = _GDIPlus_PenCreate(BitOR(0xFF000000, $COLOR_MEDGRAY)) Global Const $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hFlexGrid) ; double buffer Global $hBMP = _WinAPI_CreateBitmap($widthFlexGrid, $heightFlexGrid, 1, 32) Global $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBMP) Global $hGraphics2 = _GDIPlus_ImageGetGraphicsContext($hImage) _InitializeIntervalGrid() $hIntervalsColumn = GUICreate("", $widthIntervals, $heightIntervals, $intervalsLeftOffset, $intervalsTopOffset, $WS_POPUP, $WS_EX_MDICHILD, $hMainWindow) _GUIScrollbars_Generate($hIntervalsColumn, 0, $heightFlexScrollbar + $barThickness + $intervalRowCount, True) ;~ _CreateIntervalColumn() GUISetBkColor($COLOR_SILVER, $hIntervalsColumn) GUISetState(@SW_SHOW, $hIntervalsColumn) $hSkillsetsRow = GUICreate("", $widthSkillsets, $heightSkillsets, $skillsetsLeftOffset, $skillsetsTopOffset, $WS_POPUP, $WS_EX_MDICHILD, $hMainWindow) _GUIScrollbars_Generate($hSkillsetsRow, $widthFlexScrollbar + $barThickness + $skillsetColumnCount, 0, True) ;~ _CreateSkillsetRow() GUISetBkColor($COLOR_SILVER, $hSkillsetsRow) GUISetState(@SW_SHOW, $hSkillsetsRow) #endregion Setup Flex Grid #region Setup Destination GUI $hDestinationWindow = GUICreate("", $widthDest, $heightDest, $widthMain + $mainLeftOffset, $mainTopOffset, $stylesDestinationWindow) $EditLogWindow = GUICtrlCreateEdit("", 2, 42, ($widthDest) - 6, $heightDest - 112, BitOR($WS_HSCROLL, $WS_VSCROLL)) $ButtonStampLog = GUICtrlCreateButton("Stamp Log", 70, $heightDest - 50, 100, 25) $LabelStatusDest = GUICtrlCreateLabel($sStatusMessageDest, 0, $heightDest - 16, $widthDest, 16, $stylesStatusbar) GUISetState(@SW_SHOW, $hDestinationWindow) #endregion Setup Destination GUI #endregion Setup GUI, Menus, Tabs, and Grid Definitions #region Message Handlers ;~ GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") ; Declare Command message handler GUIRegisterMsg($WM_MOVE, "_WM_MOVE") ; Declare WindowIsMoving message handler GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") ; Declare Notify message handler GUIRegisterMsg($WM_VSCROLL, "WM_VSCROLL") GUIRegisterMsg($WM_HSCROLL, "WM_HSCROLL") GUIRegisterMsg($WM_PAINT, "WM_PAINT") #endregion Message Handlers #region Timers _Timer_SetTimer($hMainWindow, 1000, "_UpdateStatusBarClock") #endregion Timers #region MAIN ; ============================================================================================================================== ;~ _LocateEveryTrackingWindow() ;~ _OpenDatabase() ;~ _LoadRulesets() ;~ _TestUpdateSpeed() $Run = 1 ; Ready to run While 1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; How many labels are we going through? ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; If $countGridLabels + $countSkillsetLabels + $countIntervalLabels + $countOtherLabels + $countExtraLabel1 <> $totalLabels Then GUICtrlSetData($tempLabel2, $countGridLabels) GUICtrlSetData($tempLabel3, $countSkillsetLabels) GUICtrlSetData($tempLabel4, $countIntervalLabels) GUICtrlSetData($tempLabel5, $countOtherLabels) $totalLabels = $countGridLabels + $countSkillsetLabels + $countIntervalLabels + $countOtherLabels + $countExtraLabel1 GUICtrlSetData($tempLabel6, $totalLabels) GUICtrlSetData($tempExtraLabel1, $countExtraLabel1) EndIf ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; How many labels are we going through? ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; $msg = GUIGetMsg() Select ;~ Case $msg = $MenuFileLoadLoginIDs ;~ _LoadLoginIDs() Case $msg = $ButtonStampLog _WriteToLogWindow("(" & @HOUR & ":" & @MIN & ":" & @SEC & ") " & "Sample: Process Update123 completed") Case $msg = $TabMainControl $sTabNowDisplaying = _TabIsNowDisplaying() If ($sTabNowDisplaying = "Triggers" Or $sTabNowDisplaying = "Reporting") Then GUISetState(@SW_HIDE, $hFlexGrid) GUISetState(@SW_HIDE, $hIntervalsColumn) GUISetState(@SW_HIDE, $hSkillsetsRow) Else GUISetState(@SW_SHOW, $hFlexGrid) GUISetState(@SW_SHOW, $hIntervalsColumn) GUISetState(@SW_SHOW, $hSkillsetsRow) EndIf Case $msg = $MenuViewStatusbar _ToggleStatus() Case $msg = $MenuViewDockingDocked _SetDocking() Case $msg = $MenuViewDockingSideSide _SetDockSideBySide() Case $msg = $MenuViewDockingTopBot _SetDockTopAndBottom() ; Case $msg = $MenuHelpAbout ; _HelpAboutOMNiMonitor() Case $msg = $GUI_EVENT_CLOSE Or $msg = $MenuFileExit ExitLoop EndSelect _WinAPI_SetWindowPos($hFlexGrid, $HWND_TOP, 0, 0, 0, 0, BitOR($SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE)) WEnd GUIDelete() _SaveAndExit() #endregion MAIN ; ============================================================================================================================== Func _InitializeIntervalGrid() _GDIPlus_GraphicsClear($hGraphics2, BitOR(0xFF000000, $COLOR_MEDGRAY)) ;~ For $c = 1 To $skillsetColumnCount ;~ For $r = 1 To $intervalRowCount ; only draw visible cells ; this is an example, but you need to determine what exactly is visible Local $rows = Ceiling($widthFlexGrid / ($cellWidth + $cellLeftOffset)) Local $columns = Ceiling($heightFlexGrid / ($cellHeight + $cellTopOffset)) For $c = 1 To $rows For $r = 1 To $columns $penWeight = Random(1, 2, 1) If Random() < 0.5 Then ; Format cells placeholders randomly distributed $penColor = $hPen_COLORRED If $penWeight = 1 Then If Random() < 0.5 Then $penColor = $hPen_COLORWHITE EndIf EndIf Else $penColor = $hPen_COLORGREEN If $penWeight = 1 Then If Random() < 0.5 Then $penColor = $hPen_COLORWHITE EndIf EndIf EndIf ;~ ; Uncomment one of these to fill up the cells with placeholders ;~ $gridCellsContent[$r - 1][$c - 1] = Random(-9, 9, 1) & " " & Random(-9, 9, 1) ; actuals and deltas placeholder ;~ $gridCellsContent[$r - 1][$c - 1] = $c & " " & Random(-9, 9, 1) ; enumerate columns ;~ $gridCellsContent[$r - 1][$c - 1] = Random(-9, 9, 1) & " " & $r ; enumerate rows $gridCellsContent[$r - 1][$c - 1] = $r & " " & $c ; enumerate rows + columns _CreateBorderLabel2($gridCellsContent[$r - 1][$c - 1], _ (($c - 1) * ($cellWidth + $cellLeftOffset)) + $cellLeftOffset - 2, _ (($r - 1) * ($cellHeight + $cellTopOffset)) + $cellTopOffset - 2, _ $cellWidth + 4, $cellHeight + 4, $hPen_COLORMEDGRAY, 1) _CreateBorderLabel2("", _ (($c - 1) * ($cellWidth + $cellLeftOffset)) + $cellLeftOffset, _ (($r - 1) * ($cellHeight + $cellTopOffset)) + $cellTopOffset, _ $cellWidth, $cellHeight, $penColor, $penWeight) Next Next ; draw buffered image to GUI _GDIPlus_GraphicsDrawImage($hGraphics, $hImage, 0, 0) EndFunc ;==>_InitializeIntervalGrid ; ============================================================================================================================== Func _CreateIntervalColumn() Local $tempRC = $intervalRowCount Local $tempCC = $intervalColumnCount ReDim $tempGrid[$tempRC][$tempCC] $penColor = $COLOR_BLACK $penWeight = 2 For $c = 1 To $intervalColumnCount For $r = 1 To $intervalRowCount $tempGrid[$r - 1][$c - 1] = _DateTimeFormat($dIntervalDateSetup, 4) ; Interval placeholder $dIntervalDateSetup = _DateAdd('n', 30, $dIntervalDateSetup) _CreateBorderLabel($tempGrid[$r - 1][$c - 1], _ (($c - 1) * ($cellWidth + $cellLeftOffset)) + $cellLeftOffset - 2, _ (($r - 1) * ($cellHeight + $cellTopOffset)) + $cellTopOffset - 2, _ $cellWidth + 4, ($cellHeight - 1) + 4, $COLOR_MEDGRAY, 1, BitOR($SS_CENTER, $SS_CENTERIMAGE)) $countIntervalLabels += 2 _CreateBorderLabel($tempGrid[$r - 1][$c - 1], _ (($c - 1) * ($cellWidth + $cellLeftOffset)) + $cellLeftOffset, _ (($r - 1) * ($cellHeight + $cellTopOffset)) + $cellTopOffset, _ $cellWidth, ($cellHeight - 1), $penColor, $penWeight, BitOR($SS_CENTER, $SS_CENTERIMAGE)) $countIntervalLabels += 2 Next Next EndFunc ;==>_CreateIntervalColumn ; ============================================================================================================================== Func _CreateSkillsetRow() Local $tempRC = $skillsetRowCount Local $tempCC = $skillsetColumnCount ReDim $tempGrid[$tempRC][$tempCC] ReDim $tempSkillsetContent[$tempRC][$tempCC] $penColor = $COLOR_BLACK $penWeight = 2 Local $tempSizeSkillset1 = "Skillset1", $aSizeSkillset $aSizeSkillset = _StringSize($tempSizeSkillset1, Default, Default, Default, Default, 200) ______DebugPrint______("W: " & $cellWidth & " H: " & (($cellHeight - 3) * 4) & " L: " & $cellLeftOffset & " T: " & $cellTopOffset & " --- " & _ "array0:" & $aSizeSkillset[0] & " array1:" & $aSizeSkillset[1] & " array2:" & $aSizeSkillset[2] & " array3:" & $aSizeSkillset[3]) For $c = 1 To $skillsetColumnCount For $r = 1 To $skillsetRowCount $tempGrid[$r - 1][$c - 1] = "S" & $c _CreateBorderLabel($tempGrid[$r - 1][$c - 1], _ (($c - 1) * ($cellWidth + $cellLeftOffset)) + $cellLeftOffset - 2, _ (($r - 1) * ($cellHeight + $cellTopOffset)) + $cellTopOffset - 2, _ $cellWidth + 4, (($cellHeight - 3) * 4) + 4, $COLOR_MEDGRAY, 1, BitOR($SS_CENTER, $SS_CENTERIMAGE)) $countSkillsetLabels += 2 $tempSkillsetContent[$r - 1][$c - 1] = _CreateBorderLabel($tempGrid[$r - 1][$c - 1], _ (($c - 1) * ($cellWidth + $cellLeftOffset)) + $cellLeftOffset, _ (($r - 1) * ($cellHeight + $cellTopOffset)) + $cellTopOffset, _ $cellWidth, (($cellHeight - 3) * 4), $penColor, $penWeight, BitOR($SS_CENTER, $SS_CENTERIMAGE)) $countSkillsetLabels += 2 GUICtrlSetData($tempSkillsetContent[$r - 1][$c - 1], "AB1234") _GuiCtrlSetFont($tempSkillsetContent[$r - 1][$c - 1], 15, 400, 0, ($c * 2)) Next Next EndFunc ;==>_CreateSkillsetRow ; ============================================================================================================================== Func _tempTriggersLabels() $otherLabel1 = _CreateBorderLabel("LABEL1", 30, 400, 100, 200, $COLOR_RED, 2) $countOtherLabels += 2 $otherLabel2 = _CreateBorderLabel("LABEL2", 30, 550, 80, 20, $COLOR_BLUE, 2, BitOR($SS_CENTER, $SS_CENTERIMAGE)) $countOtherLabels += 2 GUICtrlSetData($otherLabel1, "Label11") _GuiCtrlSetFont($otherLabel1, 15, 400, 0, 90) $otherLabel3 = GUICtrlCreateLabel("LABEL3", 30, 150, 80, 20, BitOR($SS_CENTER, $SS_CENTERIMAGE, $SS_SUNKEN)) $countOtherLabels += 2 ;;; Left - Top - Width - Height $otherLabel4 = GUICtrlCreateLabel("1234567890", 30, 250, 140, 140, BitOR($WS_BORDER, $SS_RIGHT, $SS_CENTERIMAGE)) GUICtrlSetData($otherLabel4, "abcdefghij") _GuiCtrlSetFont($otherLabel4, 15, 400, 0, 90) $otherLabel5 = GUICtrlCreateLabel("1234567890", 230, 250, 100, 100, BitOR($WS_BORDER, $SS_RIGHT, $SS_CENTERIMAGE)) GUICtrlSetData($otherLabel5, "abcdefghij") _GuiCtrlSetFont($otherLabel5, 15, 400, 0, 90) $otherLabel6 = GUICtrlCreateLabel("12345", 430, 250, 100, 100, BitOR($WS_BORDER, $SS_RIGHT, $SS_CENTERIMAGE)) GUICtrlSetData($otherLabel6, "abcde") _GuiCtrlSetFont($otherLabel6, 15, 400, 0, 90) $countOtherLabels += 2 EndFunc ;==>_tempTriggersLabels ; ============================================================================================================================== Func _tempOperationsLabels() GUICtrlCreateLabel("Grid GUI", 30, 80, 100, 20) GUICtrlCreateLabel("Width", 30, 100, 100, 20) $tempMeasurements1 = GUICtrlCreateLabel("", 120, 100, 100, 20) GUICtrlSetData($tempMeasurements1, $widthFlexGrid) GUICtrlCreateLabel("Height", 30, 115, 100, 20) $tempMeasurements2 = GUICtrlCreateLabel("", 120, 115, 100, 20) GUICtrlSetData($tempMeasurements2, $heightFlexGrid) GUICtrlCreateLabel("Top offset", 30, 130, 100, 20) $tempMeasurements3 = GUICtrlCreateLabel("", 120, 130, 100, 20) GUICtrlSetData($tempMeasurements3, $flexTopOffset) GUICtrlCreateLabel("Left offset", 30, 145, 100, 20) $tempMeasurements4 = GUICtrlCreateLabel("", 120, 145, 100, 20) GUICtrlSetData($tempMeasurements4, $flexLeftOffset) GUICtrlCreateLabel("Interval GUI", 30, 180, 100, 20) GUICtrlCreateLabel("Width", 30, 200, 100, 20) $tempMeasurements5 = GUICtrlCreateLabel("", 120, 200, 100, 20) GUICtrlSetData($tempMeasurements5, $widthIntervals) GUICtrlCreateLabel("Height", 30, 215, 100, 20) $tempMeasurements6 = GUICtrlCreateLabel("", 120, 215, 100, 20) GUICtrlSetData($tempMeasurements6, $heightIntervals) GUICtrlCreateLabel("Top offset", 30, 230, 100, 20) $tempMeasurements7 = GUICtrlCreateLabel("", 120, 230, 100, 20) GUICtrlSetData($tempMeasurements7, $intervalsTopOffset) GUICtrlCreateLabel("Left offset", 30, 245, 100, 20) $tempMeasurements8 = GUICtrlCreateLabel("", 120, 245, 100, 20) GUICtrlSetData($tempMeasurements8, $intervalsLeftOffset) GUICtrlCreateLabel("Skillset GUI", 30, 280, 100, 20) GUICtrlCreateLabel("Width", 30, 300, 100, 20) $tempMeasurements9 = GUICtrlCreateLabel("", 120, 300, 100, 20) GUICtrlSetData($tempMeasurements9, $widthSkillsets) GUICtrlCreateLabel("Height", 30, 315, 100, 20) $tempMeasurements10 = GUICtrlCreateLabel("", 120, 315, 100, 20) GUICtrlSetData($tempMeasurements10, $heightSkillsets) GUICtrlCreateLabel("Top offset", 30, 330, 100, 20) $tempMeasurements11 = GUICtrlCreateLabel("", 120, 330, 100, 20) GUICtrlSetData($tempMeasurements11, $skillsetsTopOffset) GUICtrlCreateLabel("Left offset", 30, 345, 100, 20) $tempMeasurements12 = GUICtrlCreateLabel("", 120, 345, 100, 20) GUICtrlSetData($tempMeasurements12, $skillsetsLeftOffset) GUICtrlCreateLabel("H-Scroll position", 30, 460, 100, 20) $tempScroll1 = GUICtrlCreateLabel("", 120, 460, 100, 20) GUICtrlCreateLabel("V-Scroll position", 30, 480, 100, 20) $tempScroll2 = GUICtrlCreateLabel("", 120, 480, 100, 20) GUICtrlCreateLabel("gridLabels", 30, 520, 100, 20) $tempLabel2 = GUICtrlCreateLabel("", 120, 520, 50, 20) GUICtrlCreateLabel("skillsetLabels", 30, 540, 100, 20) $tempLabel3 = GUICtrlCreateLabel("", 120, 540, 50, 20) GUICtrlCreateLabel("intervalLabels", 30, 560, 100, 20) $tempLabel4 = GUICtrlCreateLabel("", 120, 560, 50, 20) GUICtrlCreateLabel("otherLabels", 30, 580, 100, 20) $tempLabel5 = GUICtrlCreateLabel("", 120, 580, 50, 20) GUICtrlCreateLabel("totalLabels", 30, 600, 100, 20) $tempLabel6 = GUICtrlCreateLabel("", 120, 600, 50, 20) $countOtherLabels += 41 ;~ ;;; Uncomment this and increase the number of $skillsetColumnCount to 50 to exhaust resources ;~ $skillsetColumnCount = 50 ;~ $widthFlexScrollbar = $skillsetColumnCount * ($cellWidth + 8) ;~ ReDim $gridCellsContent[$intervalRowCount][$skillsetColumnCount] ;~ GUICtrlCreateLabel("Extra Label", 30, 640, 100, 20) ;~ $tempExtraLabel1 = GUICtrlCreateLabel("", 120, 640, 100, 20) ;~ $countExtraLabel1 += 2 ;~ GUICtrlSetData($tempExtraLabel1, $countExtraLabel1) ;~ ;;; Uncomment this to increase the number of columns to 50 to exhaust resources EndFunc ;==>_tempOperationsLabels ; ============================================================================================================================== Func _GuiCtrlSetFont($controlID, $size, $weight = 400, $attribute = 0, $rotation = 0, $fontname = "", $quality = 2) Local $fdwItalic = BitAND($attribute, 1) Local $fdwUnderline = BitAND($attribute, 2) Local $fdwStrikeOut = BitAND($attribute, 4) ReDim $ahFontEx[UBound($ahFontEx) + 1] $ahFontEx[0] += 1 $ahFontEx[$ahFontEx[0]] = _WinAPI_CreateFont($size, 0, $rotation * 10, $rotation, $weight, _ $fdwItalic, $fdwUnderline, $fdwStrikeOut, -1, 0, 0, $quality, 0, $fontname) GUICtrlSendMsg($controlID, 48, $ahFontEx[$ahFontEx[0]], 1) EndFunc ;==>_GuiCtrlSetFont ; ============================================================================================================================== Func _FontCleanUp() For $i = 1 To $ahFontEx[0] _WinAPI_DeleteObject($ahFontEx[$i]) Next _GDIPlus_PenDispose($hPen_COLORRED) _GDIPlus_PenDispose($hPen_COLORWHITE) _GDIPlus_PenDispose($hPen_COLORGREEN) _GDIPlus_PenDispose($hPen_COLORMEDGRAY) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_GraphicsDispose($hGraphics2) _GDIPlus_ImageDispose($hImage) _WinAPI_DeleteObject($hBMP) _GDIPlus_Shutdown() EndFunc ;==>_FontCleanUp ; ============================================================================================================================== Func _CreateBorderLabel($sText, $iX, $iY, $iW, $iH, $iColor, $iPenSize = 1, $iStyle = -1, $iStyleEx = 0) $internalLabelID1 = GUICtrlCreateLabel("", $iX - $iPenSize, $iY - $iPenSize, $iW + 2 * $iPenSize, $iH + 2 * $iPenSize, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, $iColor) GUICtrlSetState(-1, $GUI_SHOW) $internalLabelID2 = GUICtrlCreateLabel($sText, $iX, $iY, $iW, $iH, BitOR($SS_CENTER, $SS_CENTERIMAGE), $iStyleEx) GUICtrlSetBkColor(-1, $COLOR_WHITE) GUICtrlSetState(-1, $GUI_SHOW) Return $internalLabelID2 EndFunc ;==>_CreateBorderLabel Func _CreateBorderLabel2($sText, $iX, $iY, $iW, $iH, $iColor, $iPenSize = 1) _GDIPlus_GraphicsDrawRect($hGraphics2, $iX - $iPenSize, $iY - $iPenSize, $iW + 2 * $iPenSize, $iH + 2 * $iPenSize, $iColor) If $sText Then _GDIPlus_GraphicsDrawString($hGraphics2, $sText, $iX, $iY, "Arial", 9) EndFunc ;==>_CreateBorderLabel ; ============================================================================================================================== Func _TabIsNowDisplaying() Local $sTabSelected $sTabSelected = _GUICtrlTab_GetItemText($TabMainControl, _GUICtrlTab_GetCurSel($TabMainControl)) ;______DebugPrint______("Tab is now = " & $sTabSelected) Return $sTabSelected EndFunc ;==>_TabIsNowDisplaying ; ============================================================================================================================== Func _TabSelectionIsChanging($sTabSelected) Sleep(0) ;______DebugPrint______("Tab was = " & $sTabSelected) EndFunc ;==>_TabSelectionIsChanging ; ============================================================================================================================== Func _WriteToLogWindow($sMessage) GUICtrlSetData($EditLogWindow, $sMessage & @CRLF, 1) EndFunc ;==>_WriteToLogWindow ; ============================================================================================================================== Func ______DebugPrint______($s_text, $line = @ScriptLineNumber) ; Usage: ;______DebugPrint______("$variable= " & $variable) ConsoleWrite( _ "-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _ "+======================================================" & @LF) EndFunc ;==>______DebugPrint______ ; ============================================================================================================================== Func _OpenFile() $sFile = FileOpenDialog("Choose file...", $sSourceDirecory, "All (*.*)") $oExcel = _ExcelBookOpen($sFile, 1) If @error = 1 Then MsgBox(0, "Error!", "Unable to Create the Excel Object") Exit ElseIf @error = 2 Then MsgBox(0, "Error!", "Unable to open the RollCall tracker!" & @CRLF & @CRLF & _ "1. Close RollCall" & @CRLF & _ "2. Save any open spreadsheets" & @CRLF & _ "3. Restart RollCall") Exit EndIf GUICtrlSetState($MenuFileLoadSave, $GUI_DISABLE) EndFunc ;==>_OpenFile ; ============================================================================================================================== Func _Save() _SetMainStatusBusyMessage("Saving...") _ExcelBookSave($oExcel) ; This method will Save without any prompts GUICtrlSetState($MenuFileLoadSave, $GUI_DISABLE) _SetMainStatusReadyMessage("Saved") EndFunc ;==>_Save ; ============================================================================================================================== Func _SaveAndExit() _ExcelBookClose($oExcel, 1, 0) ; This method will Save and Exit without any prompts EndFunc ;==>_SaveAndExit ; ============================================================================================================================== Func _SetDocking() If BitAND(GUICtrlRead($MenuViewDockingDocked), $GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($MenuViewDockingDocked, $GUI_UNCHECKED) $Dock = 0 Else GUICtrlSetState($MenuViewDockingDocked, $GUI_CHECKED) $Dock = 2 EndIf If $Dock Then _KeepWindowsDocked() EndFunc ;==>_SetDocking ; ============================================================================================================================== Func _SetDockSideBySide() If BitAND(GUICtrlRead($MenuViewDockingSideSide), $GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($MenuViewDockingSideSide, $GUI_UNCHECKED) GUICtrlSetState($MenuViewDockingTopBot, $GUI_CHECKED) $Dock_Location = 2 Else GUICtrlSetState($MenuViewDockingSideSide, $GUI_CHECKED) GUICtrlSetState($MenuViewDockingTopBot, $GUI_UNCHECKED) $Dock_Location = 1 If $Dock Then $Dock = 2 EndIf If $Dock Then _KeepWindowsDocked() EndFunc ;==>_SetDockSideBySide ; ============================================================================================================================== Func _SetDockTopAndBottom() If BitAND(GUICtrlRead($MenuViewDockingTopBot), $GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($MenuViewDockingTopBot, $GUI_UNCHECKED) GUICtrlSetState($MenuViewDockingSideSide, $GUI_CHECKED) $Dock_Location = 1 Else GUICtrlSetState($MenuViewDockingTopBot, $GUI_CHECKED) GUICtrlSetState($MenuViewDockingSideSide, $GUI_UNCHECKED) $Dock_Location = 2 If $Dock Then $Dock = 2 EndIf If $Dock Then _KeepWindowsDocked() EndFunc ;==>_SetDockTopAndBottom ; ============================================================================================================================== Func _KeepWindowsDocked() Local $p_win1 = WinGetPos($hMainWindow) Local $p_win2 = WinGetPos($hDestinationWindow) If $Dock_Location == 1 Then If (($p_win1[0] <> $x1 Or $p_win1[1] <> $y1) And BitAND(WinGetState($hMainWindow), 8) Or $Dock = 2) Then $x1 = $p_win1[0] $y1 = $p_win1[1] $x2 = $p_win1[2] + $x1 $y2 = $y1 WinMove($hDestinationWindow, "", $x2, $y2) $Dock = 1 ElseIf (($p_win2[0] <> $x2 Or $p_win2[1] <> $y2) And BitAND(WinGetState($hDestinationWindow), 8)) Then $x2 = $p_win2[0] $y2 = $p_win2[1] $x1 = $p_win2[0] - $p_win1[2] $y1 = $y2 WinMove($hMainWindow, "", $x1, $y1) EndIf Else If (($p_win1[0] <> $x1 Or $p_win1[1] <> $y1) And BitAND(WinGetState($hMainWindow), 8) Or $Dock = 2) Then $x1 = $p_win1[0] $y1 = $p_win1[1] $x2 = $x1 $y2 = $p_win1[3] + $y1 WinMove($hDestinationWindow, "", $x2, $y2) $Dock = 1 ElseIf (($p_win2[0] <> $x2 Or $p_win2[1] <> $y2) And BitAND(WinGetState($hDestinationWindow), 8)) Then $x2 = $p_win2[0] $y2 = $p_win2[1] $x1 = $x2 $y1 = $p_win2[1] - $p_win1[3] WinMove($hMainWindow, "", $x1, $y1) EndIf EndIf EndFunc ;==>_KeepWindowsDocked ; ============================================================================================================================== Func _ToggleStatus() If BitAND(GUICtrlRead($MenuViewStatusbar), $GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($MenuViewStatusbar, $GUI_UNCHECKED) GUICtrlSetState($LabelStatusMain, $GUI_HIDE) Else GUICtrlSetState($MenuViewStatusbar, $GUI_CHECKED) GUICtrlSetState($LabelStatusMain, $GUI_SHOW) EndIf EndFunc ;==>_ToggleStatus ; ============================================================================================================================== Func _SetMainStatusBusyMessage($tStatusMessageMain) GUICtrlSetData($LabelStatusMain, $tStatusMessageMain) GUICtrlSetBkColor($LabelStatusMain, 0xff0000) Return $sStatusMessageMain EndFunc ;==>_SetMainStatusBusyMessage ; ============================================================================================================================== Func _SetDestStatusBusyMessage($tStatusMessageDest) GUICtrlSetData($LabelStatusDest, $tStatusMessageDest) GUICtrlSetBkColor($LabelStatusMain, 0xff0000) Return $sStatusMessageDest EndFunc ;==>_SetDestStatusBusyMessage ; ============================================================================================================================== Func _SetMainStatusReadyMessage($tStatusMessageMain) GUICtrlSetData($LabelStatusMain, $tStatusMessageMain) GUICtrlSetBkColor($LabelStatusMain, 0x80ff80) Return $sStatusMessageMain EndFunc ;==>_SetMainStatusReadyMessage ; ============================================================================================================================== Func _SetDestStatusReadyMessage($tStatusMessageDest) GUICtrlSetData($LabelStatusDest, $tStatusMessageDest) GUICtrlSetBkColor($LabelStatusDest, 0x80ff80) Return $sStatusMessageDest EndFunc ;==>_SetDestStatusReadyMessage ; ============================================================================================================================== Func _WM_MOVE($hWnd, $iMsg, $iwParam, $ilParam) If ($hWnd = $hMainWindow Or $hWnd = $hDestinationWindow) Then If $Run = 1 And $Dock Then _KeepWindowsDocked() EndIf EndFunc ;==>_WM_MOVE ; ============================================================================================================================== Func _WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) Local $nNotifyCode, $nID $nNotifyCode = BitShift($iwParam, 16) $nID = BitAND($iwParam, 0xFFFF) Switch $nID Case 1 = 1 ;~ Case $InputLogin, $InputName, $ComboStatus, $InputShift, $EditNotes ;~ ;Turns on the button if any of the fields change ;~ ;If $nNotifyCode = $EN_CHANGE Then GUICtrlSetData($nID, StringReplace(GUICtrlRead($nID), ".", ",")) ;~ If $nNotifyCode = $EN_CHANGE Then GUICtrlSetState($ButtonEnterAgent, $GUI_ENABLE) EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>_WM_COMMAND ; ============================================================================================================================== Func _WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndTabControl, $tInfo $hWndTabControl = $TabMainControl If Not IsHWnd($TabMainControl) Then $hWndTabControl = GUICtrlGetHandle($TabMainControl) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndTabControl Switch $iCode Case $NM_CLICK $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) ;______DebugPrint______("$NM_CLICK" & @TAB & _ ; "IDFrom: " & $iIDFrom & @TAB & "Index: " & DllStructGetData($tInfo, "Index") & @TAB & _ ; "SubItem: " & DllStructGetData($tInfo, "SubItem")) Case $TCN_SELCHANGING $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) _TabSelectionIsChanging(_GUICtrlTab_GetItemText($hWndTabControl, _GUICtrlTab_GetCurSel($hWndTabControl))) ;______DebugPrint______("$TCN_SELCHANGING" & @TAB & _ ; "IDFrom: " & $iIDFrom & @TAB & "Index: " & DllStructGetData($tInfo, "Index") & @TAB & _ ; "SubItem: " & DllStructGetData($tInfo, "SubItem")) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>_WM_NOTIFY ; ============================================================================================================================== Func WM_VSCROLL($hWnd, $msg, $wParam, $lParam) #forceref $Msg, $wParam, $lParam Local $nScrollCode = BitAND($wParam, 0x0000FFFF) Local $index = -1, $yChar, $yPos Local $Min, $Max, $Page, $Pos, $TrackPos For $x = 0 To UBound($aSB_WindowInfo) - 1 If $aSB_WindowInfo[$x][0] = $hWnd Then $index = $x $yChar = $aSB_WindowInfo[$index][3] ExitLoop EndIf Next If $index = -1 Then Return 0 ; Get all the vertial scroll bar information Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_VERT) $Min = DllStructGetData($tSCROLLINFO, "nMin") $Max = DllStructGetData($tSCROLLINFO, "nMax") $Page = DllStructGetData($tSCROLLINFO, "nPage") ; Save the position for comparison later on $yPos = DllStructGetData($tSCROLLINFO, "nPos") $Pos = $yPos $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos") Switch $nScrollCode Case $SB_TOP ; user clicked the HOME keyboard key DllStructSetData($tSCROLLINFO, "nPos", $Min) Case $SB_BOTTOM ; user clicked the END keyboard key DllStructSetData($tSCROLLINFO, "nPos", $Max) Case $SB_LINEUP ; user clicked the top arrow DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1) Case $SB_LINEDOWN ; user clicked the bottom arrow DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1) Case $SB_PAGEUP ; user clicked the scroll bar shaft above the scroll box DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page) Case $SB_PAGEDOWN ; user clicked the scroll bar shaft below the scroll box DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page) Case $SB_THUMBTRACK ; user dragged the scroll box DllStructSetData($tSCROLLINFO, "nPos", $TrackPos) EndSwitch ;~ // Set the position and then retrieve it. Due to adjustments ;~ // by Windows it may not be the same as the value set. DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS) _GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO) _GUIScrollBars_GetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO) ;// If the position has changed, scroll the window and update it $Pos = DllStructGetData($tSCROLLINFO, "nPos") If ($Pos <> $yPos) Then _GUIScrollBars_ScrollWindow($hWnd, 0, $yChar * ($yPos - $Pos)) $yPos = $Pos GUICtrlSetData($tempScroll2, $Pos) _GUIScrollBars_SetScrollInfoPos($hIntervalsColumn, $SB_VERT, $Pos) ;______DebugPrint______("V-scroll pos: " & $Pos) EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_VSCROLL ; ============================================================================================================================== Func WM_HSCROLL($hWnd, $msg, $wParam, $lParam) #forceref $Msg, $lParam Local $nScrollCode = BitAND($wParam, 0x0000FFFF) Local $index = -1, $xChar, $xPos Local $Min, $Max, $Page, $Pos, $TrackPos For $x = 0 To UBound($aSB_WindowInfo) - 1 If $aSB_WindowInfo[$x][0] = $hWnd Then $index = $x $xChar = $aSB_WindowInfo[$index][2] ExitLoop EndIf Next If $index = -1 Then Return 0 ;~ ; Get all the horizontal scroll bar information Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_HORZ) $Min = DllStructGetData($tSCROLLINFO, "nMin") $Max = DllStructGetData($tSCROLLINFO, "nMax") $Page = DllStructGetData($tSCROLLINFO, "nPage") ; Save the position for comparison later on $xPos = DllStructGetData($tSCROLLINFO, "nPos") $Pos = $xPos $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos") #forceref $Min, $Max Switch $nScrollCode Case $SB_LINELEFT ; user clicked left arrow DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1) Case $SB_LINERIGHT ; user clicked right arrow DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1) Case $SB_PAGELEFT ; user clicked the scroll bar shaft left of the scroll box DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page) Case $SB_PAGERIGHT ; user clicked the scroll bar shaft right of the scroll box DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page) Case $SB_THUMBTRACK ; user dragged the scroll box DllStructSetData($tSCROLLINFO, "nPos", $TrackPos) EndSwitch ;~ // Set the position and then retrieve it. Due to adjustments ;~ // by Windows it may not be the same as the value set. DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS) _GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO) _GUIScrollBars_GetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO) ;// If the position has changed, scroll the window and update it $Pos = DllStructGetData($tSCROLLINFO, "nPos") If ($Pos <> $xPos) Then _GUIScrollBars_ScrollWindow($hWnd, $xChar * ($xPos - $Pos), 0) GUICtrlSetData($tempScroll1, $Pos) _GUIScrollBars_SetScrollInfoPos($hSkillsetsRow, $SB_HORZ, $Pos) ;______DebugPrint______("H-scroll pos: " & $Pos) EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_HSCROLL Func WM_PAINT($hWnd, $msg, $wParam, $lParam) #forceref $hWnd, $Msg, $wParam, $lParam Switch $hWnd Case $hFlexGrid _WinAPI_RedrawWindow($hFlexGrid, 0, 0, $RDW_UPDATENOW) _InitializeIntervalGrid() _WinAPI_RedrawWindow($hFlexGrid, 0, 0, $RDW_VALIDATE) EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>MY_WM_PAINT1 point
-
1 point
-
Doctorkirk, Quite probably the correct answer. However, as you seem so put out I will welcome to the Autoit Forum - and put you out of your misery. You correctly state that the script enters an infinite loop and then becomes unresponsive. So the trick is to get the outer loop to include the check for Explorer.exe - you can use a flag to only check when you need. And as a matter of fact you would also never leave the unlock loop either. See if you can follow what is happening here - it tells you what is going on as you progress through the script: #include<GuiConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $id = 'asd', $psw = '123', $fFlag = False $maingui = GUICreate('Blocco PC', 200, 100) $b = GUICtrlCreateButton('Lock', 30, 40) GUISetBkColor('FFFFFFF', $maingui) $sb = GUICtrlCreateButton('Unlock', 100, 40) GUISetState() While 1 Switch GUIGetMsg() Case $b MsgBox(0, "Hi", "Setting the flag") $fFlag = True ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Set the flag Case $sb $logingui = GUICreate('Login', 170, 130) GUICtrlCreateLabel('Name', 2, 2) GUICtrlSetFont(-1, 8, 5000) $nome = GUICtrlCreateInput('', 2, 25, 90, 20) GUICtrlSetFont(-1, 8, 5000) GUICtrlCreateLabel('Password', 2, 50) GUICtrlSetFont(-1, 8, 5000) $pw = GUICtrlCreateInput('', 2, 65, 90, 20, 0x00020) GUICtrlSetFont(-1, 8, 5000) $login = GUICtrlCreateButton('Login', 2, 90, 80, 20) GUICtrlSetFont(-1, 8, 5000) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $login If GUICtrlRead($nome) = $id And GUICtrlRead($pw) = $psw Then ;ShellExecute('C:\Windows\explorer.exe') MsgBox(0, "Hi", "Explorer restarted") $fFlag = False ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Clear flag ToolTip("") ExitLoop ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Exit the loop Else Beep(3000, 3000) Beep(3000, 3000) Beep(3000, 3000) EndIf EndSwitch WEnd GUIDelete($logingui) Case $GUI_EVENT_CLOSE Exit EndSwitch If $fFlag Then ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Only check and close if the flag is set ToolTip("Checking for Explorer") ;If ProcessExists('explorer.exe') Then ; ProcessClose('explorer.exe') ;EndIf EndIf WEnd All clear? Please ask if not. And finally, I am not really in favour of your method of lockng the PC - there are much better ways out there if you search the forum. M231 point