Jump to content

How to make _GDIPlus_GraphicsDrawLine dont disappear on screen


senatin
 Share

Recommended Posts

I created a square Line in the screen and it disappear instantly
I tried looking arround And im so confused about the code they use.

just like for example

GUIRegisterMsg(0xF, "MY_PAINT")

I couldnt figure it out.

 

#include <WindowsConstants.au3>
#include <WinAPI.au3>
#Include <GDIPlus.au3>

HotKeySet ("-", "Setlines")
HotKeySet( "=", "Turnoff")

_GDIPlus_Startup ()

$x = 100
$y = 100
$z = 500
$t = 500
$i = True


While 1
   Sleep(100)
   If $i Then
      $i = False
      $hDC = _WinAPI_GetWindowDC(0)

      $hGraphic = _GDIPlus_GraphicsCreateFromHDC($hDC)
      $Color = 0xFFcc0000
      $hPen = _GDIPlus_PenCreate($Color, 2)

      _GDIPlus_GraphicsDrawLine($hGraphic, $x,$y,$x,$t, $hPen)
      _GDIPlus_GraphicsDrawLine($hGraphic, $z,$y,$z,$t, $hPen)
      _GDIPlus_GraphicsDrawLine($hGraphic, $x,$y,$z,$y, $hPen)
      _GDIPlus_GraphicsDrawLine($hGraphic, $x,$t,$z,$t, $hPen)
      _GDIPlus_PenSetColor($hPen, $Color)


      _WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE+$RDW_ALLCHILDREN)
      _WinAPI_ReleaseDC(0, $hDC)
   EndIf
WEnd

Func Setlines()
   $x = $x + 20
   $y = $y + 20
   $z = $z + 20
   $t = $t + 20
   $i = True
EndFunc

Func Turnoff()
   _GDIPlus_Shutdown()
   Exit
EndFunc

Can you help me out?

Link to comment
Share on other sites

#include <WindowsConstants.au3>
#include <WinAPI.au3>
#Include <GDIPlus.au3>

HotKeySet ("-", "Setlines")
HotKeySet( "{ESC}", "Turnoff")

_GDIPlus_Startup ()

$x = 100
$y = 100
$z = 500
$t = 500
$i = True

Global $hGUI = GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, BitOR($WS_EX_TRANSPARENT, $WS_EX_LAYERED, $WS_EX_TOPMOST))
GUISetBkColor(0x81234)
GUISetState()
_WinAPI_SetLayeredWindowAttributes($hGUI, 0x81234)

$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
$Color = 0xFFcc0000
$hPen = _GDIPlus_PenCreate($Color, 2)

While 1
   Sleep(100)
   If $i Then
      $i = False
      _GDIPlus_GraphicsDrawLine($hGraphic, $x,$y,$x,$t, $hPen)
      _GDIPlus_GraphicsDrawLine($hGraphic, $z,$y,$z,$t, $hPen)
      _GDIPlus_GraphicsDrawLine($hGraphic, $x,$y,$z,$y, $hPen)
      _GDIPlus_GraphicsDrawLine($hGraphic, $x,$t,$z,$t, $hPen)
   EndIf
WEnd

Func Setlines()
   $x = $x + 20
   $y = $y + 20
   $z = $z + 20
   $t = $t + 20
   $i = True
EndFunc

Func Turnoff()
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_Shutdown()
    GUIDelete($hGUI)
    Exit
EndFunc

 

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...