dickep Posted December 1, 2010 Share Posted December 1, 2010 I am doing another countdown timer and, well, the updating of the time is flickering and DRIVING ME CRAZY (short drive)!! Run it and see if your display(s) flicker also. I would like to figure out how to stop it but have not been very successful. Also, need to know if there is a more elegant way of stopping the timer in anticipation of re-starting later. Here is the code: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $x $XResolution = @DesktopHeight $YResolution = @DesktopWidth $Form1 = GUICreate("Form1", @DesktopWidth, @DesktopHeight, 0, 0, BitOR($WS_POPUP,$WS_CLIPSIBLINGS)) GUISetBkColor(0x808080) $mTimeLabel = GUICtrlCreateLabel("",48, 274, @DesktopWidth - 52,75) GUICtrlSetFont(-1, 48, 800, 0, "Times New Roman") GUICtrlSetColor(-1, 0x008000) GUICtrlSetBkColor($mTimeLabel, $GUI_BKCOLOR_TRANSPARENT) $mTimeRemaining = GUICtrlCreateLabel("", 550, 175, 800, 600) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1, 300, 800, 0, "Times New Roman") GUICtrlSetColor(-1, 0x008000) GUISetState(@SW_SHOW) HotKeySet("{ESC}","DoNothing") HotKeySet("{F10}","EndAll") HotKeySet("{F5}", "StartUp") HotKeySet("{F8}", "ResetAll") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func EndAll() Exit EndFunc Func DoNothing() EndFunc Func StartUp() $x = 121 $OLDmins = Int( $x / 60) $mChanged = False $mins = Int( $x / 60) $secs = mod( $x , 60) GUICtrlSetData($mTimeLabel,"Time Remaining:") GUICtrlSetData($mTimeRemaining, $mins & ":" & $secs) ;~ $x = 300 ; number of seconds in the 5 minutes for now While $x > 0 sleep(1000) $x -= 1 $mins = Int( $x / 60) $secs = mod( $x , 60) ;~ MsgBox(0,"","Mins: " & $mins & " Secs: " & $secs) If $OLDmins = $mins AND $mins >= 2 Then $mChanged = False Else if $mins < 2 Then Else $OLDmins = $mins $mChanged = True EndIf EndIf if $secs < 10 Then $secs = "0" & $secs EndIf if $mins < 2 Then GUICtrlSetColor($mTimeRemaining, 0xFFFF00) EndIf if $mins < 1 Then GUICtrlSetColor($mTimeRemaining, 0xFF0000) EndIf if $mChanged then GUICtrlSetData($mTimeRemaining, $mins & ":" & $secs) Else if $mins < 2 Then GUICtrlSetData($mTimeRemaining, $mins & ":" & $secs) EndIf EndIf WEnd GUICtrlSetData($mTimeRemaining, "") EndFunc Func ResetAll() $x = -1 GUICtrlSetData($mTimeLabel,"Thank you") GUICtrlSetData($mTimeRemaining, "") EndFunc Thanks E Link to comment Share on other sites More sharing options...
martin Posted December 1, 2010 Share Posted December 1, 2010 If you are using XP then try $Form1 = GUICreate("Form1", @DesktopWidth, @DesktopHeight, 0, 0, BitOR($WS_POPUP,$WS_CLIPSIBLINGS),$WS_EX_COMPOSITED) If that doesn't work you might need to have a label for each possible digit and only update the digits when they change. Or double buffering using GDIP. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
UEZ Posted December 1, 2010 Share Posted December 1, 2010 (edited) Here a GDI+ example:expandcollapse popup;fast hack by UEZ 2010 #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #Include <Misc.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) Global $w, $h, $timer, $hFont, $tLayout $XResolution = @DesktopHeight $YResolution = @DesktopWidth $Form1 = GUICreate("Form1", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_TOPMOST) $bg = "808080" GUISetBkColor($bg, $Form1) _WinAPI_SetLayeredWindowAttributes($Form1, "0x" & $bg, 255) GUISetBkColor("0x" & $bg) GUISetState(@SW_SHOW) #region GDI+ init _GDIPlus_Startup() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($Form1) $hBitmap = _GDIPlus_BitmapCreateFromGraphics($XResolution, $YResolution, $hGraphic) $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetSmoothingMode($hBackbuffer, 2) $hBrush = _GDIPlus_BrushCreateSolid() $hBrush_bg = _GDIPlus_BrushCreateSolid("0xFF" & $bg) $hFormat = _GDIPlus_StringFormatCreate () $hFamily = _GDIPlus_FontFamilyCreate ("Times New Roman") SetFont(48, 48, 274) _GDIPlus_BrushSetSolidColor($hBrush, 0xFF008000) _GDIPlus_GraphicsDrawStringEx($hGraphic, "Time Remaining:", $hFont, $tLayout, $hFormat, $hBrush) SetFont(150, 0, 0) #endregion GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $dll = DllOpen("user32.dll") Reset() Func SetFont($fSize, $x, $y) $hFont = _GDIPlus_FontCreate ($hFamily, $fSize) $tLayout = _GDIPlus_RectFCreate ($x, $y, 0, 0) EndFunc While Sleep(30) If _IsPressed("70", $dll) Then ;F1 start / resume SetFont(48, 48, 274) _GDIPlus_BrushSetSolidColor($hBrush, 0xFF008000) _GDIPlus_GraphicsDrawStringEx($hGraphic, "Time Remaining:", $hFont, $tLayout, $hFormat, $hBrush) _GDIPlus_GraphicsFillRect($hGraphic, 510, 0, $XResolution, $YResolution, $hBrush_bg) _GDIPlus_BrushSetSolidColor($hBrush, 0xFF008000) SetFont(150, 0, 0) AdlibRegister("Start", 1000) EndIf If _IsPressed("71", $dll) Then AdlibUnRegister("Start") ;F2 pause If _IsPressed("72", $dll) Then ;F3 reset counter AdlibUnRegister("Start") _GDIPlus_GraphicsClear($hGraphic, "0xFF" & $bg) $string = "Thank you!" SetFont(100, 510, 240) _GDIPlus_BrushSetSolidColor($hBrush, 0xFF0000B0) _GDIPlus_GraphicsDrawStringEx($hGraphic, $string , $hFont, $tLayout, $hFormat, $hBrush) EndIf WEnd Func Reset() $timer = 130 ;130 seconds _GDIPlus_BrushSetSolidColor($hBrush, 0xFF008000) _GDIPlus_GraphicsFillRect($hGraphic, 510, 200, $w, $h, $hBrush_bg) EndFunc Func Start() If $timer < 120 Then _GDIPlus_BrushSetSolidColor($hBrush, 0xFFFFFF00) If $timer < 60 Then _GDIPlus_BrushSetSolidColor($hBrush, 0xFFFF0000) If $timer = 0 Then AdlibUnRegister("Start") $string = Convert($timer) $aInfo = _GDIPlus_GraphicsMeasureString ($hGraphic, $string, $hFont, $tLayout, $hFormat) _GDIPlus_GraphicsDrawStringEx($hBackbuffer, $string , $hFont, $tLayout, $hFormat, $hBrush) $w = DllStructGetData($aInfo[0], "Width") $h = DllStructGetData($aInfo[0], "Height") _GDIPlus_GraphicsDrawImageRectRect($hGraphic, $hBitmap, 0, 0, $w, $h, 510, 200, $w, $h) $timer -= 1 _GDIPlus_GraphicsFillRect($hBackbuffer, 0, 0, $w, $h, $hBrush_bg) EndFunc Func Convert($t) $h = Floor($t / 3600) $m = Floor(($t - $h * 3600) / 60) $s = Mod($t, 60) Return StringFormat('%02i:%02i:%02i',$h, $m, $s) EndFunc Func _Exit() $tLayout = "" DllClose($dll) _GDIPlus_FontDispose ($hFont) _GDIPlus_FontFamilyDispose ($hFamily) _GDIPlus_StringFormatDispose ($hFormat) _GDIPlus_BrushDispose($hBrush) _GDIPlus_BrushDispose($hBrush_bg) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_GraphicsDispose($hBackbuffer) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() GUIDelete($Form1) Exit EndFuncIt is a fast hack! Br,UEZ Edited December 1, 2010 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
dickep Posted December 1, 2010 Author Share Posted December 1, 2010 (edited) UEZ,Thanks and a GOOD hack! However, I do have a couple of questions:1. How do I "hide" the timer? I want to actually have the message "Thank you" replace the timer if I stop the timer. 2. On the converse, how can I "unhide" the timer when I want it to start. I would like to have the F1 key (example) show the timer and start it. Maybe have F3 stop it and then display the "Thank You" message.3. How do I get the displayed time background to be transparent? Could not find anything in the help files or code to do this.Again, thanks all for your help.E Edited December 1, 2010 by dickep Link to comment Share on other sites More sharing options...
UEZ Posted December 1, 2010 Share Posted December 1, 2010 Look to post #3 again. Do you mean something like this? Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
dickep Posted December 1, 2010 Author Share Posted December 1, 2010 UEZ - wish I had your knowledge. It is closer. The "Time remaining" is still showing and it would be nice to have it go away also. Now how to get the timer background transparent. It is gray in my window. I have not modified your "hack". I am trying to digest your code and it will take a while (maybe longer if I keep getting interrupted). Thanks again for all your help. E Link to comment Share on other sites More sharing options...
UEZ Posted December 1, 2010 Share Posted December 1, 2010 Which OS you are using? On my Win7 x64 whole window is transparent - only letters and numbers can be seen. Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
dickep Posted December 1, 2010 Author Share Posted December 1, 2010 (edited) This will be on both XP and Windows 7 (both 32 and 64bit). Testing right now on XP. NOTE: only the timer changes after the first "change". The initial value is on a transparent background, then the rest as counted down is on the gray. E Edited December 1, 2010 by dickep Link to comment Share on other sites More sharing options...
UEZ Posted December 1, 2010 Share Posted December 1, 2010 Very strange! I will start my VMs and test it there. Btw, I update the code again. Br,UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
UEZ Posted December 1, 2010 Share Posted December 1, 2010 Yes, indeed on my WinXP vm I can see the rectangle! Odd! Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
dickep Posted December 2, 2010 Author Share Posted December 2, 2010 Any ideas on how to fix/work around? I really need this and this could be a very big problem. E Link to comment Share on other sites More sharing options...
UEZ Posted December 2, 2010 Share Posted December 2, 2010 Here another fast hack expandcollapse popup;fast hack by UEZ 2010 #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #Include <Misc.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) Global $timer, $case $XResolution = @DesktopWidth $YResolution = 300 $Form1 = GUICreate("", @DesktopWidth, $YResolution, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST)) GUISetState(@SW_SHOW) #region GDI+ init _GDIPlus_Startup() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($Form1) $hBitmap = _GDIPlus_BitmapCreateFromGraphics($XResolution, $YResolution, $hGraphic) $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetSmoothingMode($hBackbuffer, 2) $ScreenDc = _WinAPI_GetDC($Form1) $gdibitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) $dc = _WinAPI_CreateCompatibleDC($ScreenDc) _WinAPI_SelectObject($dc, $gdibitmap) ; _WinAPI_UpdateLayeredWindow parameters $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", $XResolution) DllStructSetData($tSize, "Y", $YResolution) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", 255) DllStructSetData($tBlend, "Format", 1) $tPoint = DllStructCreate($tagPOINT) $pPoint = DllStructGetPtr($tPoint) DllStructSetData($tPoint, "X", 0) DllStructSetData($tPoint, "Y", 0) $hBrush1 = _GDIPlus_BrushCreateSolid(0xFF008000) $hBrush2 = _GDIPlus_BrushCreateSolid(0xFF008000) $hBrush3 = _GDIPlus_BrushCreateSolid(0xFF000080) $hFormat = _GDIPlus_StringFormatCreate () $hFamily1 = _GDIPlus_FontFamilyCreate ("Times New Roman") $hFamily2 = _GDIPlus_FontFamilyCreate ("Times New Roman") $hFamily3 = _GDIPlus_FontFamilyCreate ("Times New Roman") $hFont1 = _GDIPlus_FontCreate ($hFamily1, 50) $hFont2 = _GDIPlus_FontCreate ($hFamily2, 128) $hFont3 = _GDIPlus_FontCreate ($hFamily3, 110) $tLayout1 = _GDIPlus_RectFCreate (0, 120, 0, 0) $tLayout2 = _GDIPlus_RectFCreate (500, 65, 0, 0) $tLayout3 = _GDIPlus_RectFCreate (500, 75, 0, 0) _GDIPlus_GraphicsDrawStringEx($hBackbuffer, "Time Remaining:", $hFont1, $tLayout1, $hFormat, $hBrush1) #endregion GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $dll = DllOpen("user32.dll") $t = 130 $timer = $t Draw() While Sleep(30) If _IsPressed("70", $dll) Then ;F1 start / resume $case = 2 AdlibRegister("Start", 1000) EndIf If _IsPressed("71", $dll) Then AdlibUnRegister("Start") ;F2 pause If $case <> 3 Then If _IsPressed("72", $dll) Then ;F3 reset counter AdlibUnRegister("Start") $case = 3 Draw() Start() $timer = $t EndIf EndIf WEnd Func Start() If $timer < 120 Then _GDIPlus_BrushSetSolidColor($hBrush2, 0xFFFFFF00) If $timer < 60 Then _GDIPlus_BrushSetSolidColor($hBrush2, 0xFFFF0000) If $timer = 0 Then AdlibUnRegister("Start") _GDIPlus_GraphicsDrawStringEx($hBackbuffer, "Time Remaining:", $hFont1, $tLayout1, $hFormat, $hBrush1) Switch $case Case 2 $string = Convert($timer) _GDIPlus_GraphicsDrawStringEx($hBackbuffer, $string, $hFont2, $tLayout2, $hFormat, $hBrush2) $timer -= 1 Case 3 _GDIPlus_GraphicsDrawStringEx($hBackbuffer, "Thank You!", $hFont3, $tLayout3, $hFormat, $hBrush3) EndSwitch Draw() EndFunc Func Draw() $gdibitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) _WinAPI_SelectObject($dc, $gdibitmap) _WinAPI_UpdateLayeredWindow($Form1, $ScreenDc, 0, $pSize, $dc, $pSource, 0, $pBlend, 2) _WinAPI_DeleteObject($gdibitmap) _GDIPlus_GraphicsClear($hBackbuffer, 0x00000000) EndFunc Func Convert($t) $h = Floor($t / 3600) $m = Floor(($t - $h * 3600) / 60) $s = Mod($t, 60) Return StringFormat('%02i:%02i:%02i',$h, $m, $s) EndFunc Func _Exit() $tLayout = "" DllClose($dll) _GDIPlus_FontDispose ($hFont1) _GDIPlus_FontDispose ($hFont2) _GDIPlus_FontDispose ($hFont3) _GDIPlus_FontFamilyDispose ($hFamily1) _GDIPlus_FontFamilyDispose ($hFamily2) _GDIPlus_FontFamilyDispose ($hFamily3) _GDIPlus_StringFormatDispose ($hFormat) _GDIPlus_BrushDispose($hBrush1) _GDIPlus_BrushDispose($hBrush2) _GDIPlus_BrushDispose($hBrush3) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_GraphicsDispose($hBackbuffer) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() _WinAPI_DeleteDC($dc) _WinAPI_ReleaseDC($Form1, $ScreenDc) GUIDelete($Form1) Exit EndFuncBr,UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
dickep Posted December 2, 2010 Author Share Posted December 2, 2010 (edited) Well, this works until I put a picture in (ie, GUICtrlCreatePic). Then, the timer does not show up. Otherwise, if I use it with the normal background (desktop), it does not show the gray rectangle in XP. Thanks again E Edited December 2, 2010 by dickep Link to comment Share on other sites More sharing options...
UEZ Posted December 3, 2010 Share Posted December 3, 2010 Well, this works until I put a picture in (ie, GUICtrlCreatePic). Then, the timer does not show up.Otherwise, if I use it with the normal background (desktop), it does not show the gray rectangle in XP.Thanks againEI don't know why the grey rectangle appears on WinXP but I know why it appears only for the countdown timer because only that particular area will be refreshed!Now your turn to investigate some time to find out how to set a background pic that will displayed behind the timer!I will give you some hints:_GDIPlus_ImageLoadFromFile()_GDIPlus_GraphicsDrawImage()think about the order how to draw to backbuffer!Br,UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
taietel Posted December 4, 2010 Share Posted December 4, 2010 Maibe this it helps. It's not with GDIP: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <WinApi.au3> Opt("GUIOnEventMode", 1) HotKeySet("{ESC}","DoNothing") HotKeySet("{F1}","TogglePause");<<<<<< if press once, pause the counter; if pressed again, start the counter HotKeySet("{F2}","ShowHide");<<<<<< if press once, hide the counter; if pressed again, show the counter ;HotKeySet("{F5}", "StartUp") HotKeySet("{F8}", "ResetAll");<<<<<< set the value of the counter to default one (in this case, $x=130) HotKeySet("{F10}","EndAll") Global $x=130 Global $reset=False Global $pause=False Global $hide=False $Form1 = GUICreate("Form1", @DesktopWidth, @DesktopHeight, 0, 0, BitOR($WS_POPUP,$WS_CLIPSIBLINGS),BitOR($WS_EX_COMPOSITED,$WS_EX_LAYERED,$WS_EX_TOPMOST)) GUISetBkColor(0x808080) $mTimeLabel = GUICtrlCreateLabel("",0, (@DesktopHeight-75)/2, (@DesktopWidth-150)/2,75,$SS_RIGHT) GUICtrlSetFont(-1, 48, 800, 0, "Times New Roman") GUICtrlSetColor(-1, 0x008000) GUICtrlSetBkColor($mTimeLabel, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetState(-1,$GUI_HIDE) $mTimeRemaining = GUICtrlCreateLabel("", (@DesktopWidth-100)/2, (@DesktopHeight-400)/2, (@DesktopWidth-100)/2, 400,$SS_CENTERIMAGE) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1, 120, 800, 0, "Times New Roman") GUICtrlSetColor(-1, 0x008000) GUICtrlSetState(-1,$GUI_HIDE) _WinAPI_SetLayeredWindowAttributes($Form1,0x808080,180) GUISetState(@SW_SHOW) StartUp() While 1 Sleep(10) WEnd Func EndAll() Exit EndFunc Func DoNothing() EndFunc Func StartUp() While $reset = False If $hide=False Then GUICtrlSetState($mTimeLabel,$GUI_SHOW) GUICtrlSetState($mTimeRemaining,$GUI_SHOW) GUICtrlSetData($mTimeLabel,"Time Remaining:") $string = Convert($x) GUICtrlSetData($mTimeRemaining, $string) Else GUICtrlSetState($mTimeLabel,$GUI_HIDE) GUICtrlSetState($mTimeRemaining,$GUI_HIDE) EndIf If $x<0 Then ExitLoop Sleep(1000) If $pause=False Then $x -= 1 Else $x=$x EndIf WEnd EndFunc Func TogglePause() ;stop/start the counter Switch $pause Case False $pause=True Return Case True $pause=False Return EndSwitch EndFunc Func ShowHide() ;show or hide the counter Switch $hide Case False $hide=True Return Case True $hide=False Return EndSwitch EndFunc Func ResetAll() ;$reset counter to default value $x=130 EndFunc Func Convert($t) ;UEZ $h = Floor($t / 3600) $m = Floor(($t - $h * 3600) / 60) $s = Mod($t, 60) ;set the colour of the counter according to its value Switch $m Case 2 GUICtrlSetColor($mTimeRemaining,0xFFFF00) Case 0,1 GUICtrlSetColor($mTimeRemaining,0xFF0000) EndSwitch Return StringFormat('%02i:%02i:%02i',$h, $m, $s) EndFunc M.I. Things you should know first...In the beginning there was only ONE! And zero... Progs: Create PDF(TXT2PDF,IMG2PDF) 3D Bar Graph DeskGadget Menu INI Photo Mosaic 3D Text Link to comment Share on other sites More sharing options...
dickep Posted December 4, 2010 Author Share Posted December 4, 2010 UEZ, thank you very much for all the help. I have attached a zip file with all the stuff I need. Try it and let me know how I did. Don't really understand the GDI+ stuff so am SWAGging it somewhat. Also, I would like to compile this with the images embedded so I can redistribute it, just not sure how to do it with all the GDI+ stuff and the reshacker is confusing to me. Thanks again. ETimer.zip Link to comment Share on other sites More sharing options...
taietel Posted December 4, 2010 Share Posted December 4, 2010 For including the files use FileInstall() function. M.I. Things you should know first...In the beginning there was only ONE! And zero... Progs: Create PDF(TXT2PDF,IMG2PDF) 3D Bar Graph DeskGadget Menu INI Photo Mosaic 3D Text Link to comment Share on other sites More sharing options...
UEZ Posted December 4, 2010 Share Posted December 4, 2010 As taietel already said you can use FileInstall to extract the images and load it afterwards or you can convert the images to binary code and load it within you script!Look here for the binary code version: http://www.4shared.com/file/Jh_j-alj/Timer7.htmlI do not have enough space on http://www.autoitscript.com to upload it here.@taietel: the issue with you version and also with version from 1st post is the flickering of the countdown timer Br,UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
dickep Posted December 4, 2010 Author Share Posted December 4, 2010 UEZ, again you went above the "call of duty". Thanks a bunch. How did you convert the pictures to binary? Just wanting to know for later. Also, is there any more clear documentation on the GDI+ functions? I am reading your code and am wondering why some of the things are done - and how in some cases. Last, did you look at what I did? Was looking for some critique as I always like to improve my skills and technique. Thanks again and I know I will be asking more questions as I maybe do more. E Link to comment Share on other sites More sharing options...
UEZ Posted December 5, 2010 Share Posted December 5, 2010 UEZ, again you went above the "call of duty". Thanks a bunch. You're welcome! How did you convert the pictures to binary? Just wanting to know for later. I'm using this code from Ward to convert it binary string: $VarName = StringStripWS(InputBox("MemoryDllGen", "Select a name of variable:", "DllBinary"), 3) If $VarName = "" Then Exit $DllName = FileOpenDialog("Open dll file", @ScriptDir, "DLL file (*.*)") If $DllName = "" Then Exit $Handle = FileOpen($DllName, 16) $DllBinary = FileRead($Handle) FileClose($Handle) $LineLen = 160 $DllString = String($DllBinary) $Script = "Local $" & $VarName & " = '" & StringLeft($DllString, $LineLen) & "'" & @CRLF $DllString = StringTrimLeft($DllString, $LineLen) While StringLen($DllString) > $LineLen $Script &= " $" & $VarName & " &= '" & StringLeft($DllString, $LineLen) & "'" & @CRLF $DllString = StringTrimLeft($DllString, $LineLen) WEnd If StringLen($DllString) <> 0 Then $Script &= " $" & $VarName & " &= '" & $DllString & "'" & @CRLF ClipPut($Script) MsgBox(64, 'MemoryDll Generator', 'The result is in the clipboard, you can paste it to your script.') Exit Also, is there any more clear documentation on the GDI+ functions? I am reading your code and am wondering why some of the things are done - and how in some cases. I don't know whether there is a documentation around. Imho this forum is the best resource for GDI+ stuff - search for it and you will find a lot of examples e.g. from Authenticity, eukalyptus, Malkey, monoceres, Siao, etc. Last, did you look at what I did? Was looking for some critique as I always like to improve my skills and technique. Thanks again and I know I will be asking more questions as I maybe do more. E When I look to your code I remember my old codes - the more you stick with GDI +, the more you will learn about GDI +! Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ 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