YellowLab Posted April 4, 2008 Share Posted April 4, 2008 (edited) I have been using AutoIt for a while and have been hanging around the forums as a guest for a bit. Decided to join up - as there is a lot of good information and help available here. And I have a problem that is causing me to pull out what little hair I still have left My problem? My GUI is blinking into existence - and it isn't supposed to. The behavior is such that an area where the GUI will appear is black for an instant, then the pictures kick in. But it causes an annoying flicker. I have tried and tried to get rid of it and can't seem to identify where it is coming from. Probably something stupid. My guess is I am missing something in the order the objects are displayed. expandcollapse popup#NoTrayIcon #Include <GUIConstants.au3> #Include <GuiToolBar.au3> #Include <Array.au3> ;variable declaration Const $MY_YOFFSET = 25 Dim $nTrans, $nMsg, $nCount, $nArrayLength, $nOffset, $nYPos Dim $avElement, $avLabel Dim $sFont, $sScriptDir, $sFolderName, $sTitle, $sExePath, $sScriptDrive, $sSettingsFile Dim $temp $sSettingsFile="settings.ini" $sFont="Tahoma" ;psudeo running directories for working locally ;$sScriptDir="F:\PortableFolders\" $sScriptDir=@ScriptDir $sScriptDrive=StringLeft($sScriptDir,3) $sScriptDrive="F:\";testing purposes only $sFolderName=StringRegExp(@ScriptName,"(.*)[?: .???]",1) ;read from File $nArrayLength=IniRead($sScriptDir & $sSettingsFile, $sFolderName[0], "Entries", "Not Found") ;error handling $nCount=$nArrayLength+1 Dim $avLabel[$nCount] Dim $avIcon[$nCount] ;create main GUI panel $Form1 = GUICreate("Portable Folders Menu", 273, 573, 870, 417, BitOR($WS_SYSMENU,$WS_POPUP,$WS_CLIPSIBLINGS), BitOr($WS_EX_TOOLWINDOW, _ $WS_EX_LAYERED)) GUISetBkColor(0xFFFFFF) GUISetFont(9.5,800,0,$sFont) ;add buttons ;window title $avLabel[0]=GUICtrlCreateLabel($sFolderName[0],10,80,245,20,$SS_CENTER) GUICtrlSetBkColor($avLabel[0],$GUI_BKCOLOR_TRANSPARENT) ;loop for other labels For $nCount=1 To $nArrayLength Step 1 $nOffset=$nCount-1 $sTitle=IniRead($sScriptDir & $sSettingsFile, $sFolderName[0], "ExeName" & $nCount, "NotFound") ;error handling $sExePath=$sScriptDrive & IniRead($sScriptDir & $sSettingsFile, $sFolderName[0], "ExePath" & $nCount, "") $nYPos=110+$MY_YOFFSET*$nOffSet $avIcon[$nCount]=GUICtrlCreateIcon($sExePath,-1,15,$nYPos,20,20) $avLabel[$nCount]=GUICtrlCreateLabel ($sTitle,40,$nYPos+3,215,20,$SS_NOTIFY) GUICtrlSetBkColor($avLabel[$nCount],$GUI_BKCOLOR_TRANSPARENT) Next $Pic2 = GUICtrlCreatePic($sScriptDir & "Picts\button.bmp", 102,546,72,21,BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) $Pic1 = GUICtrlCreatePic($sScriptDir & "Picts\screencrop.bmp", 0, 0, 273, 573, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS),$WS_EX_TRANSPARENT) GUISetState(@SW_SHOW,$Form1) GUICtrlSetState($Pic1, $GUI_DISABLE) While 1 If Not WinActive("Portable Folders Menu") Then For $nTrans=255 to 0 step -1 $nTrans-=1 WinSetTrans("Portable Folders Menu","",$nTrans) Sleep(0.6) Next Exit EndIf $nMsg = GUIGetMsg() If $nMsg <> 0 Then $nCount=0 For $avElement In $avLabel If $nMsg == $avElement Then $sExePath=$sScriptDrive & IniRead($sScriptDir & $sSettingsFile, $sFolderName[0], "ExePath" & $nCount, "NotFound") MsgBox(1,"Label Clicked",$sExePath);test EndIf $nCount+=1 Next EndIf Select Case $nMsg = $GUI_EVENT_CLOSE Exit Case $nMsg = $Pic2 SysTray_ClickItem("Portable Apps Menu", "left", 1) Exit EndSelect WEnd ;==================================================================================== ;Function Name: _SysTray_ClickItem() ;Description: Click on item in Windows system tray by any substring in the title ;Parameters: $iTitle - The title of the item in Windows system tray (you can see the title of the item when mouse cursor hovered on item). ; $iButton - [optional] The button to click, "left" or "right". Default is the left button. ; $iClick - [optional] The number of times to click the mouse. Default is 2 ;Return Value(s): None ;Requirement(s): AutoIt 3.2.10.0 ;Autor(s): R.Gilman (a.k.a rasim); Siao (Thanks for idea smile.gif) ;==================================================================================== Func SysTray_ClickItem($iTitle, $iButton = "left", $iClick = 2) Local $hToolbar, $iButCount, $aRect, $i If Not $iTitle Then MsgBox(16, "Error", "Please indicate title") Return 0 EndIf $hToolbar = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]') If @error Then MsgBox(16, "Error", "System tray not found") Return 0 EndIf $iButCount = _GUICtrlToolbar_ButtonCount($hToolbar) If $iButCount = 0 Then MsgBox(16, "Error", "Not found item in system tray") Return EndIf For $i = 0 To $iButCount - 1 $cID = _GUICtrlToolbar_IndexToCommand($hToolBar, $i) If StringInStr(_GUICtrlToolbar_GetButtonText($hToolBar, $i), $iTitle) Then $aRect = _GUICtrlToolbar_GetButtonRect($hToolBar, $i) ControlClick("[Class:Shell_TrayWnd]", "", "ToolbarWindow321", $iButton, $iClick, $aRect[0], 5) $aRect = 0 Return 1 EndIf Next MsgBox(48, "Fail", "Required item not found") EndFunc Thanks in advance for any and all help! Bob Edited April 4, 2008 by YellowLab You can't see a rainbow without first experiencing the rain. Link to comment Share on other sites More sharing options...
arcticflame Posted April 4, 2008 Share Posted April 4, 2008 Try moving GUISetState(@SW_SHOW,$Form1) to just above the While loop. Link to comment Share on other sites More sharing options...
YellowLab Posted April 4, 2008 Author Share Posted April 4, 2008 I have swapped the disable and show statements with no effect. I have also put a "Sleep" statement right before the show statement and the GUI still flickers. This made me suspect something goofy in how I have called the specific elements into existence. I messed around and found out that my creation of Pic2 is causing the issue. Remove the creation of that element and the flicker goes away. Any ideas as to why that might be causing it? Thanks, Bob You can't see a rainbow without first experiencing the rain. 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