Jump to content

GDI+ want rectangle on screen without window


Recommended Posts

A while ago, starting from one of UEZ GDI+ examples I made something where I could put a few lines of text on the screen without affecting windows. Just text on screen, no extra window (well, maybe a transparent one somewhere). This is useful for progress messages from a script that is interacting with windows, and I don't want to take the focus. 
 

Now I'd like to put a rectangle on screen in the same way, without a visible window.  So I've copied in some lines  from another example, but I can't get both things to work together.

 
In the code below there's a choice of options on GUICreate, one way shows no window, just a few words on screen, the other puts a solid window with a rectangle.  How do I get no visible window, with rectangle?
 
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <GDIPlus.au3>
;#include <String.au3>
Opt('MustDeclareVars', 1)
Opt("GUIOnEventMode", 1)

Global $hwnd, $graphics, $backbuffer, $bitmap, $Pen, $fontsize_txt1
Global $brush_color, $hFamily1, $hFont1, $hFormat, $tLayout
Global $ScreenDc, $dc, $tSize, $pSize, $tSource, $pSource, $tBlend, $pBlend, $tPoint, $pPoint, $gdibitmap
Global $x1, $x2, $y1
Global $title = "Log_Window"

Global $Coord[1], $colr, $name
Dim $brush1
Global $brush

Const $max_log_lines = 12
Local $log_buffer[$max_log_lines], $log_lines


Func GDI_O($width = 740, $height = 480)
    ; Open a GDI 'window' so I can write messages to it.

    If 1 Then
    ; Visible window, + rectangle
    $hwnd = GUICreate($title, $width, $height, 500, 150)
    Else
    ; No visible window, text on screen
    $hwnd = GUICreate($title, $width, $height, 500, 150, 0, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST))
  EndIf
    ; p4, p5 were - 1 to let windows decide

    _GDIPlus_Startup()
    $graphics   = _GDIPlus_GraphicsCreateFromHWND($hwnd)
    $bitmap     = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics)
    $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)

    $ScreenDc = _WinAPI_GetDC($hWnd)
    $dc = _WinAPI_CreateCompatibleDC($ScreenDc)

    ; _WinAPI_UpdateLayeredWindow parameters
    $tSize = DllStructCreate($tagSIZE)
    $pSize = DllStructGetPtr($tSize)
    DllStructSetData($tSize, "X", $width)
    DllStructSetData($tSize, "Y", $height)
    $tSource = DllStructCreate($tagPOINT)
    $pSource = DllStructGetPtr($tSource)
    $tBlend = DllStructCreate($tagBLENDFUNCTION)
    $pBlend = DllStructGetPtr($tBlend)
    DllStructSetData($tBlend, "Alpha", 255)
    DllStructSetData($tBlend, "Format", 1)
    ; I don't really know if can remove these next 4
    ; lines, is it just relying on zeroing at start?
    ;$tPoint = DllStructCreate($tagPOINT)
    ;$pPoint = DllStructGetPtr($tPoint)
    ;DllStructSetData($tPoint, "X", 0)
    ;DllStructSetData($tPoint, "Y", 0)

    GUISetState()

    $fontsize_txt1 = 14
    $brush_color = "0xFF0FF0000"
    $brush1   = _GDIPlus_BrushCreateSolid($brush_color)

    $hFormat  = _GDIPlus_StringFormatCreate()
    $hFamily1 = _GDIPlus_FontFamilyCreate("Courier New")
    $hFont1   = _GDIPlus_FontCreate($hFamily1, $fontsize_txt1, 3)
    ; LAST PAR IS BITSET 0 none, 1 bold, 2 italic, 4 underline
    ; 8 stikethrough
    $tLayout = _GDIPlus_RectFCreate(0, 0)
    ;
    Local $ix
    For $ix = 0 to $max_log_lines - 1
        $log_buffer[$ix] = $ix
    Next
    $log_lines = 0
EndFunc

Func GDI_M2($sMsg)
    ; This puts a message in the list, scrolls oldest off list.

    Local $ix

    ConsoleWrite(StringFormat("%s\n", $sMsg))
    if $log_lines < $max_log_lines - 1 Then
        $log_lines += 1
    Else
        ; move the previous lines up
        for $ix = 0 to $max_log_lines - 2
            $log_buffer[$ix] = $log_buffer[$ix+1]
        Next
    EndIf
    $log_buffer[$log_lines] = $sMsg

    _GDIPlus_GraphicsClear($backbuffer, 0x00000000)
    for $y1 = 0 To $log_lines
        For $x = 1 To StringLen($sMsg)
            $x1 = $x * $fontsize_txt1
            ;$y1 = 0 ; $fontsize_txt1
            DllStructSetData($tLayout, "x", $x1)
            DllStructSetData($tLayout, "y", $y1 * ($fontsize_txt1 + 4) + 300)
            _GDIPlus_GraphicsDrawStringEx($backbuffer, StringMid($log_buffer[$y1], $x, 1), $hFont1, $tLayout, $hFormat, $brush1)
        Next
    Next

    $gdibitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($bitmap)
    _WinAPI_SelectObject($dc, $gdibitmap)
    _WinAPI_UpdateLayeredWindow($hWnd, $ScreenDc, 0, $pSize, $dc, $pSource, 0, $pBlend, 2)
    _WinAPI_DeleteObject($gdibitmap)
EndFunc

Func Rect_Test()
  Local $width  = 200
  Local $height = 100
  Local $size   = 200
  Local $xcoord = 100
  Local $ycoord = 100

  $Pen = _GDIPlus_PenCreate(0, 1)
  _GDIPlus_GraphicsClear($backbuffer)             ;clear buffer - black
  _GDIPlus_GraphicsClear($backbuffer, 0x00000000) ;clear buffer - null colour
  $Brush = _GDIPlus_BrushCreateSolid("0xEF" & Hex(255, 2) & Hex(255, 2) & Hex(255, 2))
  _GDIPlus_PenSetColor($Pen, "0xFF" & Hex(0, 2) & Hex(255, 2) & Hex(255, 2))

  _GDIPlus_GraphicsDrawRect($backbuffer, $xcoord, $ycoord, $size, $size, $Pen)
  _GDIPlus_GraphicsDrawRect($backbuffer, $xcoord + 1, $ycoord+1, $size-2, $size-2, $Pen)
  _GDIPlus_GraphicsDrawRect($backbuffer, $xcoord + 2, $ycoord+2, $size-4, $size-4, $Pen)
  ;_GDIPlus_GraphicsFillRect($backbuffer, $xcoord, $ycoord, $size * 3 , $size / 2 , $Brush) ; filled squares
  _GDIPlus_BrushDispose($Brush)
  _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 10, 10, $width, $height) ;copy to bitmap
  ;Beep(512,  20)
EndFunc

Func GDI_C()
    ; This should close the GDI, but not finished.
EndFunc

GDI_O()
GDI_M2("Hello there.")
Rect_Test()
Sleep(2000)
GDI_C()
 
Link to comment
Share on other sites

Try this:

#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <GDIPlus.au3>
;#include <String.au3>
Opt('MustDeclareVars', 1)
Opt("GUIOnEventMode", 1)

Global $hwnd, $graphics, $backbuffer, $bitmap, $Pen, $fontsize_txt1
Global $brush_color, $hFamily1, $hFont1, $hFormat, $tLayout
Global $ScreenDc, $dc, $tSize, $pSize, $tSource, $pSource, $tBlend, $pBlend, $tPoint, $pPoint, $gdibitmap
Global $x1, $x2, $y1
Global $title = "Log_Window"

Global $Coord[1], $colr, $name
Dim $brush1
Global $brush

Const $max_log_lines = 12
Local $log_buffer[$max_log_lines], $log_lines


Func GDI_O($width = 740, $height = 480)
    ; Open a GDI 'window' so I can write messages to it.

    If 0 Then
        ; Visible window, + rectangle
        $hwnd = GUICreate($title, $width, $height, 500, 150)
    Else
        ; No visible window, text on screen
        $hwnd = GUICreate($title, $width, $height, 500, 150, -1, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST))
    EndIf
    ; p4, p5 were - 1 to let windows decide

    _GDIPlus_Startup()
    $graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd)
    $bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics)
    $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
    GUISetState()

    $fontsize_txt1 = 14
    $brush_color = 0xFFFF0000
    $brush1 = _GDIPlus_BrushCreateSolid($brush_color)

    $hFormat = _GDIPlus_StringFormatCreate()
    $hFamily1 = _GDIPlus_FontFamilyCreate("Courier New")
    $hFont1 = _GDIPlus_FontCreate($hFamily1, $fontsize_txt1, 3)
    ; LAST PAR IS BITSET 0 none, 1 bold, 2 italic, 4 underline
    ; 8 stikethrough
    $tLayout = _GDIPlus_RectFCreate(0, 0)
    ;
    Local $ix
    For $ix = 0 To $max_log_lines - 1
        $log_buffer[$ix] = $ix
    Next
    $log_lines = 0
EndFunc   ;==>GDI_O

Func GDI_M2($sMsg)
    ; This puts a message in the list, scrolls oldest off list.

    Local $ix

    ConsoleWrite(StringFormat("%s\n", $sMsg))
    If $log_lines < $max_log_lines - 1 Then
        $log_lines += 1
    Else
        ; move the previous lines up
        For $ix = 0 To $max_log_lines - 2
            $log_buffer[$ix] = $log_buffer[$ix + 1]
        Next
    EndIf
    $log_buffer[$log_lines] = $sMsg

    _GDIPlus_GraphicsClear($backbuffer, 0x00000000)
    For $y1 = 0 To $log_lines
        For $x = 1 To StringLen($sMsg)
            $x1 = $x * $fontsize_txt1
            ;$y1 = 0 ; $fontsize_txt1
            DllStructSetData($tLayout, "x", $x1)
            DllStructSetData($tLayout, "y", $y1 * ($fontsize_txt1 + 4))
            _GDIPlus_GraphicsDrawStringEx($backbuffer, StringMid($log_buffer[$y1], $x, 1), $hFont1, $tLayout, $hFormat, $brush1)
        Next
    Next

EndFunc   ;==>GDI_M2

Func Rect_Test()
    Local $width = 200
    Local $height = 100
    Local $size = 200
    Local $xcoord = 100
    Local $ycoord = 100

    $Pen = _GDIPlus_PenCreate(0, 1)
;~  _GDIPlus_GraphicsClear($backbuffer) ;clear buffer - black
;~  _GDIPlus_GraphicsClear($backbuffer, 0x00000000) ;clear buffer - null colour
    $brush = _GDIPlus_BrushCreateSolid("0xEF" & Hex(255, 2) & Hex(255, 2) & Hex(255, 2))
    _GDIPlus_PenSetColor($Pen, "0xFF" & Hex(0, 2) & Hex(255, 2) & Hex(255, 2))

    _GDIPlus_GraphicsDrawRect($backbuffer, $xcoord, $ycoord, $size, $size, $Pen)
    _GDIPlus_GraphicsDrawRect($backbuffer, $xcoord + 1, $ycoord + 1, $size - 2, $size - 2, $Pen)
    _GDIPlus_GraphicsDrawRect($backbuffer, $xcoord + 2, $ycoord + 2, $size - 4, $size - 4, $Pen)
    ;_GDIPlus_GraphicsFillRect($backbuffer, $xcoord, $ycoord, $size * 3 , $size / 2 , $Brush) ; filled squares
    _GDIPlus_BrushDispose($brush)
    _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 10, 10, $width, $height) ;copy to bitmap
    ;Beep(512,  20)
EndFunc   ;==>Rect_Test

Func GDI_C()
    ; This should close the GDI, but not finished.
EndFunc   ;==>GDI_C


Func SetTransparentBitmap($hGUI, $hImage, $iOpacity = 0xFF)
    Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend
    $hScrDC = _WinAPI_GetDC(0)
    $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC)
    $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
    $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap)
    $tSize = DllStructCreate($tagSIZE)
    $pSize = DllStructGetPtr($tSize)
    DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage))
    DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage))
    $tSource = DllStructCreate($tagPOINT)
    $pSource = DllStructGetPtr($tSource)
    $tBlend = DllStructCreate($tagBLENDFUNCTION)
    $pBlend = DllStructGetPtr($tBlend)
    DllStructSetData($tBlend, "Alpha", $iOpacity)
    DllStructSetData($tBlend, "Format", 1)
    _WinAPI_UpdateLayeredWindow($hGUI, $hMemDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)
    _WinAPI_ReleaseDC(0, $hScrDC)
    _WinAPI_SelectObject($hMemDC, $hOld)
    _WinAPI_DeleteObject($hBitmap)
    _WinAPI_DeleteDC($hMemDC)
EndFunc   ;==>SetTransparentBitmap

GDI_O()
GDI_M2("Hello there.")
Rect_Test()
SetTransparentBitmap($hwnd, $bitmap)
Sleep(2000)
GDI_C()

Br,

UEZ

Edited 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

  • 1 year later...

Try this:

#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <GDIPlus.au3>
;#include <String.au3>
Opt('MustDeclareVars', 1)
Opt("GUIOnEventMode", 1)

Global $hwnd, $graphics, $backbuffer, $bitmap, $Pen, $fontsize_txt1
Global $brush_color, $hFamily1, $hFont1, $hFormat, $tLayout
Global $ScreenDc, $dc, $tSize, $pSize, $tSource, $pSource, $tBlend, $pBlend, $tPoint, $pPoint, $gdibitmap
Global $x1, $x2, $y1
Global $title = "Log_Window"

Global $Coord[1], $colr, $name
Dim $brush1
Global $brush

Const $max_log_lines = 12
Local $log_buffer[$max_log_lines], $log_lines


Func GDI_O($width = 740, $height = 480)
    ; Open a GDI 'window' so I can write messages to it.

    If 0 Then
    ; Visible window, + rectangle
    $hwnd = GUICreate($title, $width, $height, 500, 150)
    Else
    ; No visible window, text on screen
    $hwnd = GUICreate($title, $width, $height, 500, 150, -1, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST))
  EndIf
    ; p4, p5 were - 1 to let windows decide

    _GDIPlus_Startup()
    $graphics   = _GDIPlus_GraphicsCreateFromHWND($hwnd)
    $bitmap     = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics)
    $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
    GUISetState()

    $fontsize_txt1 = 14
    $brush_color = "0xFF0FF0000"
    $brush1   = _GDIPlus_BrushCreateSolid($brush_color)

    $hFormat  = _GDIPlus_StringFormatCreate()
    $hFamily1 = _GDIPlus_FontFamilyCreate("Courier New")
    $hFont1   = _GDIPlus_FontCreate($hFamily1, $fontsize_txt1, 3)
    ; LAST PAR IS BITSET 0 none, 1 bold, 2 italic, 4 underline
    ; 8 stikethrough
    $tLayout = _GDIPlus_RectFCreate(0, 0)
    ;
    Local $ix
    For $ix = 0 to $max_log_lines - 1
        $log_buffer[$ix] = $ix
    Next
    $log_lines = 0
EndFunc

Func GDI_M2($sMsg)
    ; This puts a message in the list, scrolls oldest off list.

    Local $ix

    ConsoleWrite(StringFormat("%s\n", $sMsg))
    if $log_lines < $max_log_lines - 1 Then
        $log_lines += 1
    Else
        ; move the previous lines up
        for $ix = 0 to $max_log_lines - 2
            $log_buffer[$ix] = $log_buffer[$ix+1]
        Next
    EndIf
    $log_buffer[$log_lines] = $sMsg

    _GDIPlus_GraphicsClear($backbuffer, 0x00000000)
    for $y1 = 0 To $log_lines
        For $x = 1 To StringLen($sMsg)
            $x1 = $x * $fontsize_txt1
            ;$y1 = 0 ; $fontsize_txt1
            DllStructSetData($tLayout, "x", $x1)
            DllStructSetData($tLayout, "y", $y1 * ($fontsize_txt1 + 4) + 300)
            _GDIPlus_GraphicsDrawStringEx($backbuffer, StringMid($log_buffer[$y1], $x, 1), $hFont1, $tLayout, $hFormat, $brush1)
        Next
    Next

    $gdibitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($bitmap)
    _WinAPI_SelectObject($dc, $gdibitmap)
    _WinAPI_UpdateLayeredWindow($hWnd, $ScreenDc, 0, $pSize, $dc, $pSource, 0, $pBlend, 2)
    _WinAPI_DeleteObject($gdibitmap)
EndFunc

Func Rect_Test()
  Local $width  = 200
  Local $height = 100
  Local $size   = 200
  Local $xcoord = 100
  Local $ycoord = 100

  $Pen = _GDIPlus_PenCreate(0, 1)
  _GDIPlus_GraphicsClear($backbuffer)             ;clear buffer - black
  _GDIPlus_GraphicsClear($backbuffer, 0x00000000) ;clear buffer - null colour
  $Brush = _GDIPlus_BrushCreateSolid("0xEF" & Hex(255, 2) & Hex(255, 2) & Hex(255, 2))
  _GDIPlus_PenSetColor($Pen, "0xFF" & Hex(0, 2) & Hex(255, 2) & Hex(255, 2))

  _GDIPlus_GraphicsDrawRect($backbuffer, $xcoord, $ycoord, $size, $size, $Pen)
  _GDIPlus_GraphicsDrawRect($backbuffer, $xcoord + 1, $ycoord+1, $size-2, $size-2, $Pen)
  _GDIPlus_GraphicsDrawRect($backbuffer, $xcoord + 2, $ycoord+2, $size-4, $size-4, $Pen)
  ;_GDIPlus_GraphicsFillRect($backbuffer, $xcoord, $ycoord, $size * 3 , $size / 2 , $Brush) ; filled squares
  _GDIPlus_BrushDispose($Brush)
  _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 10, 10, $width, $height) ;copy to bitmap
  ;Beep(512,  20)
EndFunc

Func GDI_C()
    ; This should close the GDI, but not finished.
EndFunc


Func SetTransparentBitmap($hGUI, $hImage, $iOpacity = 0xFF)
    Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend
    $hScrDC = _WinAPI_GetDC(0)
    $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC)
    $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
    $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap)
    $tSize = DllStructCreate($tagSIZE)
    $pSize = DllStructGetPtr($tSize)
    DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage))
    DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage))
    $tSource = DllStructCreate($tagPOINT)
    $pSource = DllStructGetPtr($tSource)
    $tBlend = DllStructCreate($tagBLENDFUNCTION)
    $pBlend = DllStructGetPtr($tBlend)
    DllStructSetData($tBlend, "Alpha", $iOpacity)
    DllStructSetData($tBlend, "Format", 1)
    _WinAPI_UpdateLayeredWindow($hGUI,  $hMemDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)
    _WinAPI_ReleaseDC(0, $hScrDC)
    _WinAPI_SelectObject($hMemDC, $hOld)
    _WinAPI_DeleteObject($hBitmap)
    _WinAPI_DeleteDC($hMemDC)
EndFunc   ;==>SetTransparentBitmap

GDI_O()
GDI_M2("Hello there.")
Rect_Test()
SetTransparentBitmap($hwnd, $bitmap)
Sleep(2000)
GDI_C()

 

 

 

not sure how to quote something with code, so I guess this is a test post - I do not see the all the code in the box, it extends past and I cannot get to a text window - this is the same issue I think I have reported in the past...that is why I now add a period under my code boxes, as otherwise, I can never edit my posts

 

Br,

UEZ

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

Anyway, as for my question...I do not see the text on the window, only in the console box - did I miss something?

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

The reason was that the bitmap was erased after the text was drawn to the bitmap.

I updated the code - please try again.

 

Beware that the resource clean up is not added here!

Edited 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

I have a question, before running your script...what happens to the resources that might be left behind - they take up memory? Anything else?

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

Where is the 'O' coming from above the 'H'?

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

Well, I wouldn't do it that way.

GDI_O is initializing the GDI+ stuff

GDI_M2 is drawing the chars

Rect_Test creates the rectangle

SetTransparentBitmap makes the bitmap transparent

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

I am asking about the O over the Hello - over the H...is it supposed to be there, and where in the code is the 'O' coming from?

 

I understand about disposing the GDI variables

Edited by nitekram

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

It works as designed. If you put this line in the function GDI_M2

ConsoleWrite(StringMid($log_buffer[$y1], $x, 1) & @CRLF)

just after 

_GDIPlus_GraphicsDrawStringEx($backbuffer, StringMid($log_buffer[$y1], $x, 1), $hFont1, $tLayout, $hFormat, $brush1)

you will see that the "0" will be used from the array $log_buffer wihere the value in $log_buffer[0] = 0.

 

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

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
 Share

  • Recently Browsing   0 members

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