Jump to content

Double Buffer

Recommended Posts

Is there any way to double buffer this?

Func drawpix($dc,$x,$y,$color)
$dll = DllOpen("user32.dll")
$dc= DllCall ("user32.dll", "int", "GetDC", "hwnd", "")
DllCall ("gdi32.dll", "long", "SetPixel", "long", $dc[0], "long", $x, "long", $y, "long", $color)
DllCall ("user32.dll", "int", "ReleaseDC", "hwnd", 0,  "int", $dc[0])
Link to comment
Share on other sites

  • Moderators

What are you talking about?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Sorry I should explain more. The script above sets a cerain pixel a certain color.

Double buffering helps reduce flicker


Double buffering the change of a single pixel is not going to do anything more than waste some time. Is the problem that you are changing a lot of pixels and you get some flickering? For double buffering you need to change the pixels in a memory DC, then when all the pixels have been drawn copy the memory DC to the Gui DC. Or, stop Windows updating the gui, change all the pixels then allow the window to be redrawn.

SendMessage( $Gui, $WM_SETREDRAW,0,0);stop redrawing

;change the pixels

SendMessage( $Gui, $WM_SETREDRAW,1,0);allow redrawing
DllCall("user32.dll", "int", "InvalidateRect", "hwnd", $GUI "int", 0, "int", 1);force a redraw

If the pixels are changed on a control in the gui then instead of $gui you can use the handle for the control.

Edited by martin
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...