Jump to content

Recommended Posts

Posted (edited)

I was looking around the help file and I came across _GDIPlus_GraphicsDrawRect and _WinAPI_DrawLine and I seem to be having the same "problem" where every time it draws into a window and you lose or gain focus it has to redraw itself. Is there anyway around this? 

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

_GDIPlus_Startup()

Run("notepad.exe")
$hWnd = WinWait("Untitled")

$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd)
$Color = 0xFFFF0000
$hPen = _GDIPlus_PenCreate($Color, 2)


For $i = 1 To 10
    _GDIPlus_GraphicsDrawRect($hGraphic, 200, 200, 25 ,25, $hPen)
    ToolTip($i)
    Sleep(1000)
Next

_WinAPI_RedrawWindow($hWnd, 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_PenDispose($hPen)
_GDIPlus_Shutdown()

 

Edited by badcoder123
Posted

There is a way i think, if you create a transparent GUI, then whatever you paint stays there, other than that, i dont think so, whenever the application refreshes, your drawing is gone, so maybe you have to keep drawing, a lot.

 

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted
20 minutes ago, careca said:

There is a way i think, if you create a transparent GUI, then whatever you paint stays there, other than that, i dont think so, whenever the application refreshes, your drawing is gone, so maybe you have to keep drawing, a lot.

 

Is it possible to make it so you can click through the GUI or make a hole in it?

Posted

Maybe, but im not an expert on it, i've seen gui's where only an image is clickable, and the rest is go-through.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted (edited)

based on the link a small example making red rect area (actually the hwnd with custom rect) around the notepad editable area

  • Hard to close the window in itself use alt+f4 or just close notepad and example will break ;-)

 

#include <GuiConstants.au3>
#include <guiconstantsex.au3>
#include <winapi.au3>

Run("notepad.exe")

; Wait 10 seconds for the Notepad window to appear.
$hWnd =    WinWait("[CLASS:Notepad]", "", 10)

; Retrieve the position as well as height and width of the active window.
Local $aPos = WinGetPos($hWnd)

; Display the array values returned by WinGetPos.
;~ MsgBox($MB_SYSTEMMODAL, "", "X-Pos: " & $aPos[0] & @CRLF & _
;~             "Y-Pos: " & $aPos[1] & @CRLF & _
;~             "Width: " & $aPos[2] & @CRLF & _
;~             "Height: " & $aPos[3])

$gW=$aPos[2] - 8
$gH=$aPos[3] - 40
$gX=$aPos[0] + 4
$gY=$aPos[1] + 48

$hGUI = GUICreate("Test", $gW, $gH, $gX, $gY , BitOr($WS_POPUP,$WS_DLGFRAME))
;~ $hGUI = GUICreate("Test", $gW, $gH, $gX, $gY )
GUISetBkColor(0xFF0000)

GUISetState()

While 1
  If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit

    ; Retrieve the position as well as height and width of the active window.
    $aPos = WinGetPos($hWnd)
;~  winsetontop($hgui,"",$WINDOWS_NOONTOP)
    $gW=$aPos[2] - 8
    $gH=$aPos[3] - 60
    $gX=$aPos[0] + 4
    $gY=$aPos[1] + 48
    _GUICreateInvRect($hGUI, 4, 4, $gW-8, $gH-8)
    winmove($hGui,"",$gX,$gY, $gW, $gH)
winsetontop($hgui,"",$WINDOWS_ONTOP)
    sleep(100)
Wend

Func _GUICreateInvRect($hWnd, $iX, $iY, $iW, $iH)

    $aPos = WinGetPos($hWnd)

    Local $hMask_1 = _WinAPI_CreateRectRgn(0, 0, $aPos[2], $iY)
    Local $hMask_2 = _WinAPI_CreateRectRgn(0, 0, $iX, $aPos[3])
    Local $hMask_3 = _WinAPI_CreateRectRgn($iX + $iW, 0, $aPos[2], $aPos[3])
    Local $hMask_4 = _WinAPI_CreateRectRgn(0, $iY + $iH, $aPos[2], $aPos[3])

    _WinAPI_CombineRgn($hMask_1, $hMask_1, $hMask_2, 2)
    _WinAPI_CombineRgn($hMask_1, $hMask_1, $hMask_3, 2)
    _WinAPI_CombineRgn($hMask_1, $hMask_1, $hMask_4, 2)

    _WinAPI_DeleteObject($hMask_2)
    _WinAPI_DeleteObject($hMask_3)
    _WinAPI_DeleteObject($hMask_4)

    _WinAPI_SetWindowRgn($hWnd, $hMask_1, 1)

EndFunc

 

Edited by junkew

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
×
×
  • Create New...