Jump to content
Iznogoud

Red border / red highlight application window

Recommended Posts

Hi,

I am struggling to get a Windows application to have a red border around it or a red menu in the application itself by using a transparent PNG file.

It is quite simple what i need, when a user opens a specific program it should draw a red border around it, telling the user to only use the application to view data and not to work in it.

Anyone have a clue how to get this done?

I have found this topic: https://www.autoitscript.com/forum/topic/97306-how-to-draw-a-line-around-a-window/ but for some reason i will not work properly with an example window like notepad.

Someone who could help me to push me in to the right direction?

Share this post


Link to post
Share on other sites

Hi, im thinking gdi+ could work, drawing on top or everything, or a transparent gui with the borders painted, there are many ways of doing this.

I think personaly i would go with gdi. I'll see if i can come up with something.

In order to prevent a user to work on the application you could just set a transparent gui on top of it, preventing clicks or any kind of interaction, i really think this is possible.


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

Share this post


Link to post
Share on other sites
Posted (edited)

Little did i know, i had saved this example from somewhere in the forum: (uses notepad to demo)

#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 , $WS_POPUP);BitOr($WS_POPUP,$WS_DLGFRAME))
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)
    $gX=$aPos[0] + 8    ;X position
    $gY=$aPos[1] + 8    ;Y position
    $gW=$aPos[2] - 16   ;Width
    $gH=$aPos[3] - 12   ;Height
    _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 careca

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

Share this post


Link to post
Share on other sites
Posted (edited)

This one doesn't show any border, it just lays over the notepad window, letting only the titlebar accessible.

#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_OVERLAPPED), $WS_EX_LAYERED, $hWnd)

;$hGUI = GUICreate("Test", $gW, $gH, $gX, $gY , BitOr($WS_POPUP,$WS_OVERLAPPED), $WS_EX_TRANSPARENT, $hWnd) ;Comment the line above and uncomment these 2 to see where what the window covers up.
;GUISetBkColor(0x6688AA)

GUISetState()

While 1
  If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit
    $aPos = WinGetPos($hWnd)
    $gX=$aPos[0] + 8    ;X position
    $gY=$aPos[1] + 28   ;Y position
    $gW=$aPos[2] - 16   ;Width
    $gH=$aPos[3] - 36   ;Height
    winmove($hGui,"",$gX,$gY, $gW, $gH)
    winsetontop($hgui,"",$WINDOWS_ONTOP)
    sleep(100)
Wend

 

Edited by careca

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

Share this post


Link to post
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...