Jump to content

Search the Community

Showing results for tags '$WS_EX_COMPOSITED'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. I previously >posted a problem I was having emulating an old-fashioned dual-projector slide show. There were random flashes and tears between pictures. While I ultimately discovered that the problem went away if I switched my W8 system to use only its NVidia GPU, and returned if I added back the built-in Intel GPU and its monitor, JohnOne supplied a solution that eliminated the video problems even with the Intel GPU. It's called "GUI double buffering". So now I'm working on another section of my project: a countdown timer. In this script I'm using some GDI+ commands recommended by UEZ. The video problem is back: as the numbers decrement during the countdown the entire image occasionally flickers when I'm using the Intel GPU and NVIDIA GPU's. As before, the flickering doesn't happen if I use only the NVIDIA GPU. Running the script on a laptop with only an Intel GPU yielded the flickering problem, so my guess is that an NVIDIA GPU is powerful enough to handle this sort of graphics demand but Intel GPUs are not -- even a relatively state-of-the-art HD4000 with an I7-3770. If I try using JohnOne's double-buffering solution the numbers don't even appear. I assume $WS_EX_COMPOSITED is incompatible with GDI+. My question is: can someone show me how to modify my code so that double-buffering is implemented? I'll include below a "double-buffering for GDI+" template attributed to monoceres, but I've gotten nowhere extrapolating how to use it in my script. Below is the script, and here is a link to the mono-spaced LCD font used . Attached is the jpg background image used in my script. #cs This is the foundation for a countdown timer based on code from Wakillon. It used a standard form with a solid color background. Instead of a solid color background I wanted to use a JPG. UEZ recommend some GDI+ commands. My ultimate goal is to overlay a PNG with alpha channel transparency so LCD appears in the PNG's window #ce #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> ;included to try UEZ's suggestions Global $SS_CENTER, $CountdownTime = 20000, $_Minutes, $_Seconds, $hImage, $hBitmapGDI Global Const $IMAGE_BITMAP = 0, $STM_SETIMAGE = 0x0172 HotKeySet("{ESC}", "_Terminate") ;ESC to bail out $_GuiCountDown = GUICreate ( "CountDown...", 832, 339, @DesktopWidth/2 -250, @DesktopHeight/2 -100,BitOR($WS_SYSMENU,$WS_POPUP),0 ) $BackgroundImage = GUICtrlCreatePic( "", 0, 0, 832, 339 ) GUICtrlSetState( -1, $GUI_DISABLE ) ;I think this is needed in order to use GDIPlus commands _GDIPlus_Startup() ;per UEZ's recommendation $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\CountdownTimerBG.jpg") $hBitmapGDI = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _WinAPI_DeleteObject( GUICtrlSendMsg( $BackgroundImage, $STM_SETIMAGE, $IMAGE_BITMAP, $hBitmapGDI)) $TimeLabel = GUICtrlCreateLabel ( "", 30, 5, 772, 293, $SS_CENTER ) GUICtrlSetFont ( -1, 240, 400, 0, "Digital-7", 4 ) GUICtrlSetBkColor( -1, -2) GUISetState ( ) WinSetOnTop ( $_GuiCountDown, "", 1 ) $TimeTicks = TimerInit ( ) While 1 _Check ( ) Sleep ( 1000 ) WEnd _Terminate() Exit Func _Check ( ) $CountdownTime -= TimerDiff ( $TimeTicks ) $TimeTicks = TimerInit ( ) Local $_MinCalc = Int ( $CountdownTime / ( 60 * 1000 ) ), $_SecCalc = $CountdownTime - ( $_MinCalc * 60 * 1000 ) $_SecCalc = Int ( $_SecCalc / 1000 ) If $_MinCalc <= 0 And $_SecCalc <= 0 Then Sleep ( 2000 ) _Terminate () Else If $_MinCalc <> $_Minutes Or $_SecCalc <> $_Seconds Then $_Minutes = $_MinCalc $_Seconds = $_SecCalc GUICtrlSetData ( $TimeLabel, StringFormat ( "%02u" & ":" & "%02u", $_Minutes, $_Seconds ) ) EndIf EndIf EndFunc ;==> _Check ( ) Func _Terminate() ; I believe the following are also needed when using GDIPlus commands. Have I included everything? ; From Help file re "_GDIPlus_BitmapCreateHBITMAPFromBitmap" it says: ; "When you are done with the Bitmap object, call _WinAPI_DeleteObject to release the resources" so... _WinAPI_DeleteObject($hBitmapGDI) ; Clean up resource _GDIPlus_ImageDispose($hImage) ; Shut down GDI+ library _GDIPlus_Shutdown() Exit EndFunc ;==> _Terminate() Below is the double-buffering template for GDI+ that's attributed to monoceres. #include <GUIConstants.au3> #include <GDIplus.au3> Global Const $width = 600 Global Const $height = 400 Global $title = "GDI+" ; Build your GUI here Opt("GUIOnEventMode", 1) $hwnd = GUICreate($title, $width, $height) GUISetOnEvent($GUI_EVENT_CLOSE, "close") GUISetState() ; Load your GDI+ resources here: _GDIPlus_Startup() $graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd) $bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics) $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap) While 1 _GDIPlus_GraphicsClear($backbuffer) ; Draw your GDI+ scene onto $backbuffer here _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height) Sleep(10) WEnd Func close() _GDIPlus_GraphicsDispose($backbuffer) _GDIPlus_BitmapDispose($bitmap) _GDIPlus_GraphicsDispose($graphics) _GDIPlus_Shutdown() Exit EndFunc ;==>close Background for LCD:
×
×
  • Create New...