RagsRevenge Posted May 24, 2011 Share Posted May 24, 2011 (edited) Hi, I am rewriting a Unicode overlay to sit over an existing, non-unicode capable application. The overlay can then automatically navigate the underlying application. There are a number of "pages" to the application. It is navigated via tab style buttons at the bottom of the screen. I have created a global array of "Tab Buttons": $aTabButtons[100odd], which are each associated with a page number. For each place that I need unicode, I am creating a label into a global array: $aLabels[100][70]. For example, page 1's labels are created and added to the $aLabels array at row 1. Done this way, I can simply show all items on row 1 when I want to display page 1. The problem I have is that, as the $aLabels array grows and contains more elements, the responsiveness of the program degrades. If I have 350 labels in the $aLabels array, the overlay works "perfectly". When this rises to 2000, there is a 3 second period after I click on a tab button, where the whole computer appears to freeze (mouse frozen, clock stops, process list in task manager stops updating). I believe the max CPU usage the overlay uses is 50% and it only uses less than 20MB memory. The computer is a Pentium Dual CPU @ 2GHz, with 4 GB RAM and Win XP SP 3. I have included my while loop below... While 1 Sleep(10) $msg = GUIGetMsg() ConsoleWrite("Looping" & @CRLF) Switch $msg Case $GUI_EVENT_CLOSE Exit Case $aTabButs[0][0] to $aTabButs[UBound($aTabButs) - 1][0] ConsoleWrite("about to search for tab button" & @CRLF) $tabButtonIndex = _ArraySearch($aTabButs, $msg, 0, 0, 0, 0, 1, $eHandle) GUISetState(@SW_LOCK) ;#TODO: Need to tweak the GUI lock so that the page transitions work optimally ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $tabButtonIndex = ' & $tabButtonIndex & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console _showPageNumber(_getPageNumberFromTabEnglishCaption($aTabButs[$tabButtonIndex][$eEnglishCaption], $aTabButs[$tabButtonIndex][$eLineage])) GUISetState(@SW_UNLOCK) #cs Case $aButtons[0][0] to $aButtons[UBound($aButtons) - 1][0] $buttonIndex = _ArraySearch($aButtons, $msg, 0, 0, 0, 0, 1, $eButtonHandle) if $buttonIndex <> - 1 Then ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $aButtons[$buttonIndex][$eButtonCommand] = ' & $aButtons[$buttonIndex][$eButtonCommand] & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console GUISetState(@SW_LOCK) Execute($aButtons[$buttonIndex][$eButtonCommand]) GUISetState(@SW_UNLOCK) EndIf ;#ce EndSwitch ConsoleWrite("After Switch" & @CRLF) WEnd So, normally, the console is being populated with Looping After Switch When I click on a tab button, this stops, and consistently 3 seconds later... about to search for tab button appears. I have commented out the $aButtons[0][0] to $aButtons[UBound($aButtons) - 1][0] Case with no difference. I don't understand what relevance the size of the labels array has on my while loop? I would understand if the _showPageNumber function got slower depending on the number of labels to display, but this makes no sense to me? [EDIT] I've just noticed that I get the delay when I click on a label as well. The overlay loses focus as it controls the underlying application. The delay appears to occur when my overlay gets focus???[/EDIT] Could any of the hardcore AutoIters explain what is happening? Thanks for the help, D Edited May 24, 2011 by RagsRevenge Link to comment Share on other sites More sharing options...
BrewManNH Posted May 24, 2011 Share Posted May 24, 2011 I'm guessing your array search is eating up the time when you get a lot of items in your array. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 24, 2011 Moderators Share Posted May 24, 2011 RagsRevenge,You speak of $aLabels being fairly large and slowing your script - but you do not reference the array in that snippet so it is difficult to say anything sensible at all! However, are you sure that your code works at all? You seem to be looking for the ControlIDs of the individual TabItems in your GUIGetMsg loop. TabItems do not fire events - you need to look for the overall tab control and then use GUICtrlRead to get the actual item. This script based on your code shows this - try selecting Tab 0, you never get the ConsoleWrite: #include <GUIConstantsEx.au3> #include <Array.au3> Global $aTabButs[10][2] $hGUI = GUICreate("Test", 500, 500) $hTab = GUICtrlCreateTab(10, 10, 400, 400) For $i = 0 To 9 $aTabButs[$i][0] = GUICtrlCreateTabItem("Tab " & $i) Next ConsoleWrite("Tab 0 has ControlID " & $aTabButs[0][0] & @CRLF) GUISetState() While 1 Sleep(10) $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $aTabButs[0][0] ; Check for the first tab item ConsoleWrite("Tab 0 selected" & @CRLF) Case $hTab ; Look for the main tab $hSelected_Tab = GUICtrlRead($hTab, 1) ; And now get the ControlID of the TabItem $tabButtonIndex = _ArraySearch($aTabButs, GUICtrlRead($hTab, 1)) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $tabButtonIndex = ' & $tabButtonIndex & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console EndSwitch WEndNow maybe you have something else in your $aTabButs array - difficult to tell from such a short snippet. Give us some more info and we can offer more pertinent advice. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
RagsRevenge Posted May 24, 2011 Author Share Posted May 24, 2011 Hi Melba, the "Tab Buttons" are actually just buttons created to lie over the existing app's non-standard tabs. They are created like this... $aTabButs[$index][$eHandle] = GUICtrlCreateButton($butCaption, $aTabs[$i][$eL], $Top, $aTabs[$i][$eW], $TabHeight, $WS_GROUP) There is consistently about 100 "tab buttons". The event is firing, and the required functionality is working. The $aLabels array is populated in the following manner... $aLabels[$pageNum][$labelCol] = GUICtrlCreateLabel($caption, $aOverlay[$i][$eOverlayLeft], $aOverlay[$i][$eOverlayTop], _ $aOverlay[$i][$eOverlayWidth], $aOverlay[$i][$eOverlayHeight], BitOr($SS_LeftNoWordWrap, $SS_CenterImage)) Melba, my consternation is due to what you say... the $aLabels array isn't directly referenced in the snippet, but it is having a huge effect on the performance of that snippet. Would 2000odd controls be considered a lot in AutoIt? Not exactly sure how to give more information. The code is 700 lines, with a 1000 line mapping/configuration program, and requiring a large number of files and an OPC server to be run. I will try to recreate a smaller example tomorrow morning, but unfortunately, as size/complexity diminishes, speed improves. Thanks, D Link to comment Share on other sites More sharing options...
RagsRevenge Posted May 24, 2011 Author Share Posted May 24, 2011 I'm guessing your array search is eating up the time when you get a lot of items in your array.Hi BrewMan,the delay is occuring before the array search. Also, the search is searching a different array to the one whose size is causing the problems.Thanks anyway,D Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 24, 2011 Moderators Share Posted May 24, 2011 (edited) RagsRevenge,Now I am glad I covered my 6 by questioning what was in $aTabBut! A question. I presume that when you press one of the buttons and function _showPageNumber runs, you are hiding/showing a lot of labels. I wonder if that is slowing it down - certainly 2000 controls is a lot, but not excessive.Try adding Opt("TrayIconDebug", 1) to the top of your script. Then when you put the mouse over the tray icon you get the currently executing line displayed. It might help to determine where you are hanging. I also remember a script somewhere on the forum which times the various functions in your script to help you optimize it - I will see if I can find it this evening. M23Edit: That took some finding! The script I mentioned is here - no idea if it still works but I did use it when it was psoted and got some interesting results. Edited May 24, 2011 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
RagsRevenge Posted May 25, 2011 Author Share Posted May 25, 2011 A question. I presume that when you press one of the buttons and function _showPageNumber runs, you are hiding/showing a lot of labels. I wonder if that is slowing it down - certainly 2000 controls is a lot, but not excessive. Try adding Opt("TrayIconDebug", 1) to the top of your script. Then when you put the mouse over the tray icon you get the currently executing line displayed. It might help to determine where you are hanging. Hi Melba, the reason I have so many consolewrites in the while loop is to identify where the code is blocking. Normally, I get a continuous stream of Looping After Switch Looping After Switch Looping After Switch When I click on a "tab button", this stream stops (along with mouse, pc clock, task manager) for 3 seconds and then I get about to search for tab button To remove all confusion, I have adjusted my while loop to While 1 Sleep(10) $msg = GUIGetMsg() ConsoleWrite("Looping" & @CRLF) Switch $msg Case $GUI_EVENT_CLOSE Exit #cs EndSwitch ConsoleWrite("After Switch" & @CRLF) WEnd I still get a 3 second delay when the GUI gets focus when there are around 2000 items on the GUI. Working on scaled down test GUI which I will submit to see if somebody can figure out what is happening. Regards, D Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 25, 2011 Moderators Share Posted May 25, 2011 RagsRevenge,This GUI has around 10000 labels with their ControlIDs stored in an array and does not seem to delay when it gets focus: expandcollapse popup#include <GUIConstantsEx.au3> Global $aLabel[10000] $fToggle = False $hActive = WinGetHandle("[ACTIVE]") ConsoleWrite("Active: " & $hActive & @CRLF) $hGUI = GUICreate("Test", 500, 500) ConsoleWrite("GUI: " & $hGUI & @CRLF) For $j = 0 To 4 For $i = 0 To 1999 $aLabel[$i + ($j * 2000)] = GUICtrlCreateLabel($hGUI, $j * 100, $i * 10, 100, 20) GUICtrlSetBkColor(-1, 0xFF0000) Next Next ConsoleWrite(GUICtrlCreateDummy() & @CRLF) GUISetState() $iBegin = TimerInit() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch If TimerDiff($iBegin) > 5000 Then $fToggle = Not $fToggle Switch $fToggle Case True ConsoleWrite("Active" & @CRLF) WinActivate($hActive) Case False ConsoleWrite("GUI" & @CRLF) WinActivate($hGUI) EndSwitch $iBegin = TimerInit() EndIf WEndI await your cut-down version with interest. M23P.S. You do not need a Sleep when you use GUIGetMsg - the function does its own idle pause. Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
GEOSoft Posted May 25, 2011 Share Posted May 25, 2011 P.S. You do not need a Sleep when you use GUIGetMsg - the function does its own idle pause.Under normal circumstances that is correct but if there are a lot of case statements it may fail.Example:If you remember the issue I was having where it looked like something in PCRE Toolkit was hooking the keyboard, the solution was to add a small sleep to the end of the Msg loop and it was caused by the number of Case statements in the Switch.That solved the previous issues including one with processor usage so it shows that the built-in delay theory may fail under extreme circumstances. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 25, 2011 Moderators Share Posted May 25, 2011 George, I just put that down to sloppy coding on your part! Seriously, I will take a look to see if I can reproduce it and then let Valik/Jon take a look. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
GEOSoft Posted May 25, 2011 Share Posted May 25, 2011 I didn't say the code wasn't sloppy, I said that a Sleep() fixed it. I started at 10ms which helped then increased it to 50ms which made the problems go away. The next version will probably be using Event code so it should be a non-issue. $sMelba = "Melba23" Sleep(50) MsgBox(0, "Oooops", "Did not work this time" & @CRLF & "Problem " & $sMelba & " did not go away") George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
RagsRevenge Posted May 26, 2011 Author Share Posted May 26, 2011 I await your cut-down version with interest. M23 While the following is not exactly how my program works, it does demonstrate the problem I've been having. The difference between this program and mine, is that in mine, I am simply sending control clicks to an underlying application rather than doing the GUISetState(@SW_HIDE)/GUISetState(@SW_SHOW). In my overlay app, there are about 100 pages. A Label could easily be created in the same position 100 times. For that reason, I am creating the labels on top of each other in the demo below expandcollapse popup#include <GUIConstants.au3> #include <GUIConstantsEX.au3> #include <windowsconstants.au3> #include <StaticConstants.au3> #Include <WinAPI.au3> #Include <File.au3> #Include <Array.au3> Opt("WinDetectHiddenText", 0) const $TransparentColour = 0xABCDEF ;any element this colour will be transparent Global $aLabels[200][200] Global $gui2 Global $gui1 $fToggle = False $hActive = WinGetHandle("[ACTIVE]") ConsoleWrite("Active: " & $hActive & @CRLF) main() $iBegin = TimerInit() While 1 ConsoleWrite("Looping" & @CRLF) Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch ConsoleWrite("After Switch" & @CRLF) If TimerDiff($iBegin) > 5000 Then $fToggle = Not $fToggle Switch $fToggle Case True ConsoleWrite("Active" & @CRLF) WinActivate($hActive) GUISetState(@SW_HIDE) Case False ConsoleWrite("GUI" & @CRLF) WinActivate($gui2) GUISetState(@SW_SHOW) EndSwitch $iBegin = TimerInit() EndIf WEnd func main() createGui() _createLabels() EndFunc func createGui() $gui1 = GUICreate("Visu Overlay", 1280, 800, 0, 0, BitOR($WS_MAXIMIZEBOX,$WS_POPUP,$WS_TABSTOP),BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) GUISetFont(6) GUISetState() $gui2 = GUICreate("Visu Overlay 2", 1280, 800, 0, 0, $WS_POPUP, BitOR(0x2000000, $WS_EX_LAYERED, $WS_EX_TOOLWINDOW));$WS_EX_COMPOSITED = 0x2000000 GUISetBkColor($TransparentColour) _API_SetLayeredWindowAttributes($gui2, $TransparentColour, 255);set special colour fully transparent GUISetState() WinSetOnTop($gui2,'',1) WinSetTrans($gui1,"",0) ;Makes underlying GUI totally transparent EndFunc Func _createLabels() Local $caption Local $labelCount = 0 For $i = 0 to 10 ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $i = ' & $i & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console $start = TimerInit() for $j = 0 to 199 $caption = "test_" & $i & "_" & $j $aLabels[$i][$j] = GUICtrlCreateLabel($caption, 100, $j * 10, 100, 20, BitOr($SS_LeftNoWordWrap, $SS_CenterImage)) ;???? GUICtrlSetTip(-1, $caption) ;GUICtrlSetState(-1, $GUI_HIDE) _BKColor(0xECE9D8, $aLabels[$i][$j]) $labelCount += 1 Next ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : TimerDiff($start) = ' & TimerDiff($start) & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console Next ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $labelCount = ' & $labelCount & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console EndFunc ;=============================================================================== ; Function Name: _API_SetLayeredWindowAttributes ; Description:: Sets Layered Window Attributes:) See MSDN for more informaion ; Parameter(s): ; $hwnd - Handle of GUI to work on ; $i_transcolor - Transparent color ; $Transparency - Set Transparancy of GUI ; $isColorRef - If True, $i_transcolor is a COLORREF-Strucure, else an RGB-Color ; Requirement(s): Layered Windows ; Return Value(s): Success: 1 ; Error: 0 ; @error: 1 to 3 - Error from DllCall ; @error: 4 - Function did not succeed - use ; _WinAPI_GetLastErrorMessage or _WinAPI_GetLastError to get more information ; Author(s): Prog@ndy ;=============================================================================== Func _API_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $isColorRef = False) Local Const $AC_SRC_ALPHA = 1 Local Const $ULW_ALPHA = 2 Local Const $LWA_ALPHA = 0x2 Local Const $LWA_COLORKEY = 0x1 If Not $isColorRef Then $i_transcolor = Hex(String($i_transcolor), 6) $i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2)) EndIf Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $LWA_COLORKEY + $LWA_ALPHA) Select Case @error Return SetError(@error, 0, 0) Case $Ret[0] = 0 Return SetError(4, 0, 0) Case Else Return 1 EndSelect EndFunc ;==>_API_SetLayeredWindowAttributes ;=========================================================================== ; Function : _BKColor( backgroundcolor, controlID, textcolor ) ; Description : Sets the background color of a control. (Transparent Label) ; : Sets the text color of a control. ; Author : Thunder-man (Frank Michalski) ; Date : 19. September 2007 ; Version : V 1.20 ; Example : _BKColor() :Transparent ; _BKColor( -1, $MyLabel) :Transparent ; _BKColor(0x00ff00) :Color Green ; _BKColor(0x00ff00, $MyLabel) :Color Green ; _BKColor( -1, $MyLabel, 0x00ff00) :Text Color Green ;=========================================================================== Func _BKColor($BackColor_ = "", $GuiID_ = -1, $Textcolor_ = 0x000000) If $BackColor_ = "" or $BackColor_ = -1 Then GUICtrlSetBkColor($GuiID_, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetColor($GuiID_, $Textcolor_) Else GUICtrlSetBkColor($GuiID_, $BackColor_) GUICtrlSetColor($GuiID_, $Textcolor_) EndIf EndFunc ;==>_BKColor The delay doesn't seem to grow linearly with the number of labels. With 2200 labels in the test app, the freeze is about 2 seconds. Inc this to 4000 labels, and the freeze is about 9 seconds. Melba, thanks for the time and interest you have shown in my problem. Regards, Donal Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 26, 2011 Moderators Share Posted May 26, 2011 RagsRevenge,I can see the problem. I set up a timer to look at how long everything "froze" and this is what I got:Active 289.454944692691 GUI 1131.48465796631 Active 302.750768603272 GUI 1058.95777256607 Active 291.325154453988 GUI 1208.12295976165 Active 296.068564580135So about 1 sec to redisplay the GUI in your example. I did wonder if the $WS_EX_LAYERED and $WS_EX_COMPOSITED styles might be affecting things, so I ran again with those styles removed:Active 296.6194725866 GUI 914.570078040645 Active 309.112191633294 GUI 927.850955917582Not a lot of improvement there! Although I am not an expert by any means, I suspect that we are running into the limitations of an interpreted language here and AutoIt just does not run fast enough to cope with all those controls. You can see how long it takes to create the labels when the script starts - so I do not find it too surprising that we run into delays when trying to redisplay them. The difference between hiding/showing is easy to understand - Windows has to do a lot more checking to confirm what must be displayed when there are so many controls - the "active" GUI (which in my case was SciTE) is much simpler. Sorry not to be optimistic about solving your problem - but given that AutoIt is not compiled even when "compiled" (I take you realise that the "compilation" process actually only adds a tokenised script to an interpreter stub?) we are left with an interpreted language and all the baggage that this entails. Added to this is the fact that AutoIt was not originally designed to run GUIs and so the GUI code is (according to the Devs) "less than optimised". One thought does strike me as a possible solution, although I am not altogether certain I understand enough of what you are trying to do to be sure this is a sensible suggestion. You speak of "pages", so could you not create each "page" on a separate GUI? Then each GUI would have a limited number of controls rather the maxed out singleton you use at the moment. In this way you would only be asking Windows to redisplay a more "reasonable" GUI and so reduce the time needed. I can see possible difficulties in this approach (tracking the GUI to redisplay for example), but if speed is what you want this is the only way I can see to advance - other than changing language of course! If you could explain in a little more detail what you are trying to do (some code snippets might be useful as well) we could look to see if my suggestion has any value. I must warn you that from this weekend I will be incommunicado for a couple of weeks (an extended family wedding overseas), so if you are on a deadline this offer is unlikely to be any use - but if you have a little more time it could be a fun project. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
RagsRevenge Posted May 26, 2011 Author Share Posted May 26, 2011 One thought does strike me as a possible solution, although I am not altogether certain I understand enough of what you are trying to do to be sure this is a sensible suggestion. You speak of "pages", so could you not create each "page" on a separate GUI? Then each GUI would have a limited number of controls rather the maxed out singleton you use at the moment.This suggestion could well work. Each "page" would only have about 70-100 labels, so it should be near instantaneaous. I'll give it a go before the end of the week.Thanks again.D Link to comment Share on other sites More sharing options...
RagsRevenge Posted May 26, 2011 Author Share Posted May 26, 2011 If you could explain in a little more detail what you are trying to do (some code snippets might be useful as well) we could look to see if my suggestion has any value. I must warn you that from this weekend I will be incommunicado for a couple of weeks (an extended family wedding overseas), so if you are on a deadline this offer is unlikely to be any use - but if you have a little more time it could be a fun project. M231 question which immediately arises is: Do I have to create a "page" GUI, and then immediately create the controls on it?Is there a way, after I've created other GUIs, that I can add controls to a previously created GUI?I had a search in the forum (including the UDFs in your sig), but everywhere I found multiple GUIs, the controls were created immediately after GUI creation.Cheers,D Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 26, 2011 Moderators Share Posted May 26, 2011 (edited) RagsRevenge,Use GUISwitch to select the GUI in which you want to create the controls. #include <GUIConstantsEx.au3> $hGUI_1 = GUICreate("Test 1", 500, 200, 100, 100) GUISetState() $hGUI_2 = GUICreate("Test 2", 500, 200, 100, 400) GUISetState() GUISwitch($hGUI_1) GUICtrlCreateLabel("I am in Test 1", 10, 10) GUISwitch($hGUI_2) GUICtrlCreateLabel("I am in Test 2", 10, 10) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEndM23Edit: Added code. Edited May 26, 2011 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
RagsRevenge Posted September 1, 2011 Author Share Posted September 1, 2011 Having gotten stuck on a couple of points with this project, I got pulled onto other work, and am only revisiting this again. I have the program very close to working according to Melba's suggestion of using a new GUI for each page, and then simply showing/hiding GUIs rather than individual labels, but have run into a fairly serious obstacle... Only 5 "subGUIs" are being shown. Below is a cut down (and *very* rough around the edges) version. As you'll see in the script below, I am creating 9 "subGUIs", each with 5 labels. All handles (GUIs and Labels) are being created as expected. After a label is created, I can successfully read the caption from it. I am then cycling through each GUI, showing 1 and hiding the 1 previous to it. Only the first 5 are displaying on screen, even though the result of the GuiSetState command to show the GUIs is returning 1. I have traced the problem to the GUI extended style: $WS_EX_LAYERED. Unfortunately, I think I need this, as the background of the GUI needs to be transparent (The script is being used to place unicode labels over a non-unicode program). I have searched online, and have found no description of the limitation that I am experiencing. Anybody have any ideas about it or alternatives to using this extended style? expandcollapse popup#include <GUIConstants.au3> #include <GUIConstantsEX.au3> #include <windowsconstants.au3> #include <StaticConstants.au3> #Include <WinAPI.au3> #Include <File.au3> #Include <Array.au3> Opt("WinDetectHiddenText", 0) const $TransparentColour = 0xABCDEF ;any element this colour will be transparent Global $aLabels[10][10] Global $gui1 Global $aGuis[1] ;Global $aLabels[200][200] main() $index = 1 While 1 ConsoleWrite("Looping" & @CRLF) Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch _hidePage($index - 1) _showPage($index) sleep(500) $index += 1 If $index > 8 Then $index = 1 EndIf ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $index = ' & $index & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console WEnd Func _hidePage($iPageNumber) ;ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $iPageNumber = ' & $iPageNumber & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console GUISetState(@SW_HIDE, $aGuis[$iPageNumber]) EndFunc Func _showPage($iPageNumber) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $iPageNumber = ' & $iPageNumber & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console $ShowGuiResult = GUISetState(@SW_SHOW, $aGuis[$iPageNumber]) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $ShowGuiResult = ' & $ShowGuiResult & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console EndFunc func main() createBaseGui() ReDim $aGuis[10] _createLabels() EndFunc func createBaseGui() $gui1 = GUICreate("Visu Overlay", 1280, 1024, 0, 0, BitOR($WS_MAXIMIZEBOX,$WS_POPUP,$WS_TABSTOP),BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $gui1 = ' & $gui1 & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console GUISetBkColor(0xFFFFFF) GUISetFont(6) GUISetState() WinSetTrans($gui1,"",0) ;Makes underlying GUI totally transparent EndFunc Func _createSubGUI($iGuiIndex, $iWidth, $iHeight, $iTop = 0, $iLeft = 0) $aGuis[$iGuiIndex] = GUICreate("Visu Overlay " & $iGuiIndex, $iWidth, $iHeight, $iLeft, $iTop, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOOLWINDOW)) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $aGuis[$iGuiIndex] = ' & $aGuis[$iGuiIndex] & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console ;#TODO: reinstate this line GUISetBkColor($TransparentColour, $aGuis[$iGuiIndex]) _API_SetLayeredWindowAttributes($aGuis[$iGuiIndex], $TransparentColour, 255);set special colour fully transparent ;GUISetState(@SW_LOCK, $aGuis[$iGuiIndex]) ;MsgBox(0, "", "Start setting colour") GUISetState(@SW_SHOW, $aGuis[$iGuiIndex]) ;MsgBox(0, "", "Finished setting colour") WinSetOnTop($aGuis[$iGuiIndex],'',1) GUISetState(@SW_HIDE, $aGuis[$iGuiIndex]) ;GUISetState(@SW_UNLOCK, $aGuis[$iGuiIndex]) EndFunc Func _createLabels() Local $lastPageNum = 0 Local $pageNum Local $LabelIndex = -1 Local $labelCol = -1 Local $caption Local $labelCount = 1 For $i = 1 to 10 - 1 $pageNum = $i ;This code is used for keeping track of the column where the control ID is stored. if $pageNum <> $lastPageNum Then _createSubGUI($pageNum, 1280, 800) $labelCol = 0 $lastPageNum = $pageNum EndIf for $j = 1 to 5 $caption = "Label" & $j & " on Page " & $pageNum $aLabels[$pageNum][$labelCol] = GUICtrlCreateLabel($caption, 10, $j * 25, 100, 20, BitOr($SS_LeftNoWordWrap, $SS_CenterImage)) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $aLabels[$pageNum][$labelCol] = ' & $aLabels[$pageNum][$labelCol] & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : GUICtrlRead($aLabels[$pageNum][$labelCol]) = ' & GUICtrlRead($aLabels[$pageNum][$labelCol]) & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console GUICtrlSetState($aLabels[$pageNum][$labelCol], $GUI_SHOW) $labelCount += 1 GUICtrlSetTip(-1, $caption) ;GUICtrlSetState(-1, $GUI_HIDE) _BKColor(0xECE9D8, $aLabels[$pageNum][$labelCol]) $labelCol += 1 Next Next EndFunc ;=============================================================================== ; Function Name: _API_SetLayeredWindowAttributes ; Description:: Sets Layered Window Attributes:) See MSDN for more informaion ; Parameter(s): ; $hwnd - Handle of GUI to work on ; $i_transcolor - Transparent color ; $Transparency - Set Transparancy of GUI ; $isColorRef - If True, $i_transcolor is a COLORREF-Strucure, else an RGB-Color ; Requirement(s): Layered Windows ; Return Value(s): Success: 1 ; Error: 0 ; @error: 1 to 3 - Error from DllCall ; @error: 4 - Function did not succeed - use ; _WinAPI_GetLastErrorMessage or _WinAPI_GetLastError to get more information ; Author(s): Prog@ndy ;=============================================================================== Func _API_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $isColorRef = False) Local Const $AC_SRC_ALPHA = 1 Local Const $ULW_ALPHA = 2 Local Const $LWA_ALPHA = 0x2 Local Const $LWA_COLORKEY = 0x1 If Not $isColorRef Then $i_transcolor = Hex(String($i_transcolor), 6) $i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2)) EndIf Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $LWA_COLORKEY + $LWA_ALPHA) Select Case @error Return SetError(@error, 0, 0) Case $Ret[0] = 0 Return SetError(4, 0, 0) Case Else Return 1 EndSelect EndFunc ;==>_API_SetLayeredWindowAttributes ;=========================================================================== ; Function : _BKColor( backgroundcolor, controlID, textcolor ) ; Description : Sets the background color of a control. (Transparent Label) ; : Sets the text color of a control. ; Author : Thunder-man (Frank Michalski) ; Date : 19. September 2007 ; Version : V 1.20 ; Example : _BKColor() :Transparent ; _BKColor( -1, $MyLabel) :Transparent ; _BKColor(0x00ff00) :Color Green ; _BKColor(0x00ff00, $MyLabel) :Color Green ; _BKColor( -1, $MyLabel, 0x00ff00) :Text Color Green ;=========================================================================== Func _BKColor($BackColor_ = "", $GuiID_ = -1, $Textcolor_ = 0x000000) If $BackColor_ = "" or $BackColor_ = -1 Then GUICtrlSetBkColor($GuiID_, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetColor($GuiID_, $Textcolor_) Else GUICtrlSetBkColor($GuiID_, $BackColor_) GUICtrlSetColor($GuiID_, $Textcolor_) EndIf EndFunc ;==>_BKColor Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 12, 2011 Moderators Share Posted September 12, 2011 RagsRevenge, If I adjust this line (If $index > 9 Then) I get all 9 GUIs displaying without problem when using the $WS_EX_LAYERED extended style. So I do not know what your problem is. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
RagsRevenge Posted September 12, 2011 Author Share Posted September 12, 2011 RagsRevenge, If I adjust this line (If $index > 9 Then) I get all 9 GUIs displaying without problem when using the $WS_EX_LAYERED extended style. So I do not know what your problem is. M23 Thanks for the response M23, ???????? Don't know how, but that is also showing all GUIs for me today. However, if you increase the size of the array (100 in the example below), I believe you will see that only the first 12 GUIs will show, even though the return values for all the GUI/label creations and shows seem to be fine. expandcollapse popup#include <GUIConstants.au3> #include <GUIConstantsEX.au3> #include <windowsconstants.au3> #include <StaticConstants.au3> #Include <WinAPI.au3> #Include <File.au3> #Include <Array.au3> Opt("WinDetectHiddenText", 0) const $TransparentColour = 0xABCDEF ;any element this colour will be transparent Global $iSize = 100 Global $aLabels[$iSize][5] Global $gui1 Global $aGuis[1] ;Global $aLabels[200][200] main() $index = 1 While 1 ConsoleWrite("Looping" & @CRLF) Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch _hidePage($index - 1) _showPage($index) sleep(500) $index += 1 If $index > $iSize - 2 Then $index = 1 EndIf ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $index = ' & $index & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console WEnd Func _hidePage($iPageNumber) ;ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $iPageNumber = ' & $iPageNumber & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console GUISetState(@SW_HIDE, $aGuis[$iPageNumber]) EndFunc Func _showPage($iPageNumber) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $iPageNumber = ' & $iPageNumber & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console $ShowGuiResult = GUISetState(@SW_SHOW, $aGuis[$iPageNumber]) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $ShowGuiResult = ' & $ShowGuiResult & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console EndFunc func main() createBaseGui() ReDim $aGuis[$iSize] _createLabels() EndFunc func createBaseGui() $gui1 = GUICreate("Visu Overlay", 1280, 1024, 0, 0, BitOR($WS_MAXIMIZEBOX,$WS_POPUP,$WS_TABSTOP),BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $gui1 = ' & $gui1 & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console GUISetBkColor(0xFFFFFF) GUISetFont(6) GUISetState() WinSetTrans($gui1,"",0) ;Makes underlying GUI totally transparent EndFunc Func _createSubGUI($iGuiIndex, $iWidth, $iHeight, $iTop = 0, $iLeft = 0) $aGuis[$iGuiIndex] = GUICreate("Visu Overlay " & $iGuiIndex, $iWidth, $iHeight, $iLeft, $iTop, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOOLWINDOW)) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $aGuis[$iGuiIndex] = ' & $aGuis[$iGuiIndex] & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console ;#TODO: reinstate this line GUISetBkColor($TransparentColour, $aGuis[$iGuiIndex]) _API_SetLayeredWindowAttributes($aGuis[$iGuiIndex], $TransparentColour, 255);set special colour fully transparent ;GUISetState(@SW_LOCK, $aGuis[$iGuiIndex]) ;MsgBox(0, "", "Start setting colour") GUISetState(@SW_SHOW, $aGuis[$iGuiIndex]) ;MsgBox(0, "", "Finished setting colour") WinSetOnTop($aGuis[$iGuiIndex],'',1) GUISetState(@SW_HIDE, $aGuis[$iGuiIndex]) ;GUISetState(@SW_UNLOCK, $aGuis[$iGuiIndex]) EndFunc Func _createLabels() Local $lastPageNum = 0 Local $pageNum Local $LabelIndex = -1 Local $labelCol = -1 Local $caption Local $labelCount = 1 For $i = 1 to 100 - 1 $pageNum = $i ;This code is used for keeping track of the column where the control ID is stored. if $pageNum <> $lastPageNum Then _createSubGUI($pageNum, 1280, 800) $labelCol = 0 $lastPageNum = $pageNum EndIf for $j = 1 to 5 $caption = "Label" & $j & " on Page " & $pageNum $aLabels[$pageNum][$labelCol] = GUICtrlCreateLabel($caption, 10, $j * 25, 100, 20, BitOr($SS_LeftNoWordWrap, $SS_CenterImage)) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $aLabels[$pageNum][$labelCol] = ' & $aLabels[$pageNum][$labelCol] & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : GUICtrlRead($aLabels[$pageNum][$labelCol]) = ' & GUICtrlRead($aLabels[$pageNum][$labelCol]) & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console GUICtrlSetState($aLabels[$pageNum][$labelCol], $GUI_SHOW) $labelCount += 1 GUICtrlSetTip(-1, $caption) ;GUICtrlSetState(-1, $GUI_HIDE) _BKColor(0xECE9D8, $aLabels[$pageNum][$labelCol]) $labelCol += 1 Next Next EndFunc ;=============================================================================== ; Function Name: _API_SetLayeredWindowAttributes ; Description:: Sets Layered Window Attributes:) See MSDN for more informaion ; Parameter(s): ; $hwnd - Handle of GUI to work on ; $i_transcolor - Transparent color ; $Transparency - Set Transparancy of GUI ; $isColorRef - If True, $i_transcolor is a COLORREF-Strucure, else an RGB-Color ; Requirement(s): Layered Windows ; Return Value(s): Success: 1 ; Error: 0 ; @error: 1 to 3 - Error from DllCall ; @error: 4 - Function did not succeed - use ; _WinAPI_GetLastErrorMessage or _WinAPI_GetLastError to get more information ; Author(s): Prog@ndy ;=============================================================================== Func _API_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $isColorRef = False) Local Const $AC_SRC_ALPHA = 1 Local Const $ULW_ALPHA = 2 Local Const $LWA_ALPHA = 0x2 Local Const $LWA_COLORKEY = 0x1 If Not $isColorRef Then $i_transcolor = Hex(String($i_transcolor), 6) $i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2)) EndIf Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $LWA_COLORKEY + $LWA_ALPHA) Select Case @error Return SetError(@error, 0, 0) Case $Ret[0] = 0 Return SetError(4, 0, 0) Case Else Return 1 EndSelect EndFunc ;==>_API_SetLayeredWindowAttributes ;=========================================================================== ; Function : _BKColor( backgroundcolor, controlID, textcolor ) ; Description : Sets the background color of a control. (Transparent Label) ; : Sets the text color of a control. ; Author : Thunder-man (Frank Michalski) ; Date : 19. September 2007 ; Version : V 1.20 ; Example : _BKColor() :Transparent ; _BKColor( -1, $MyLabel) :Transparent ; _BKColor(0x00ff00) :Color Green ; _BKColor(0x00ff00, $MyLabel) :Color Green ; _BKColor( -1, $MyLabel, 0x00ff00) :Text Color Green ;=========================================================================== Func _BKColor($BackColor_ = "", $GuiID_ = -1, $Textcolor_ = 0x000000) If $BackColor_ = "" or $BackColor_ = -1 Then GUICtrlSetBkColor($GuiID_, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetColor($GuiID_, $Textcolor_) Else GUICtrlSetBkColor($GuiID_, $BackColor_) GUICtrlSetColor($GuiID_, $Textcolor_) EndIf EndFunc ;==>_BKColor Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 12, 2011 Moderators Share Posted September 12, 2011 RagsRevenge, I believe you will see that only the first 12 GUIs will showStill see all the GUIs - there must be something wrong with your system. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
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