Jump to content

Transparent window with border line to indicate pixelchecksum area


Recommended Posts

Hi there,

I want to create a window that is transparent everywhere except for the borders. At the borders a 1 pixel red line should be shown. The window should always be on top. I want to do this to indicate a pixelchecksum area, so that people know in what box the pixelchecksum is made.

Could anyone help me with creating such transparent window with red borders?

Edited by tom13
Link to comment
Share on other sites

I tried the following, but for some reason the line is disappearing after a few milliseconds even though it should last 5 seconds:

#RequireAdmin
#include <WindowsConstants.au3>
#include <WinAPI.au3>

;create box
Dim $hDC, $hPen, $obj_orig
$color = 0xFF
$width = @DesktopWidth
$start_x = @DesktopWidth / 2
$start_y = @DesktopHeight / 2
$length = 20
$width = 2

$hDC = _WinAPI_GetWindowDC(0) ; DC of entire screen (desktop)
$hPen = _WinAPI_CreatePen($PS_SOLID, $width, $color)
$obj_orig = _WinAPI_SelectObject($hDC, $hPen)

_WinAPI_DrawLine($hDC, $start_x - $length, $start_y, $start_x - 5, $start_y) ; horizontal left
_WinAPI_MoveTo($hDC, $start_x, $start_y + $length)
_WinAPI_LineTo($hDC, $start_x, $start_y + 5)

Sleep(5000) ; show

; refresh desktop (clear drawing)
_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)

; clear resources
_WinAPI_SelectObject($hDC, $obj_orig)
_WinAPI_DeleteObject($hPen)
_WinAPI_ReleaseDC(0, $hDC)
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...