Jump to content
Sign in to follow this  
Hypertrophy

How to draw a line around a window

Recommended Posts

Hypertrophy

For example, how would I draw a red line completely around the perimeter of a window. This is new territory for me so i have no clue. Help would be appreciated.

Share this post


Link to post
Share on other sites
BrettF

I seem to remember a topic with a similar question a while back. Try finding topics that mention the way the AutoIt window Info tool did it... Had a quick look (5minutes of searching) but nothing turned up :D

Share this post


Link to post
Share on other sites
Hypertrophy

BrettF:

do you know where i can find that program?

Share this post


Link to post
Share on other sites
Melba23

coder09,

I was interested too, so I used Search (the button is in the title bar to the right) and I found the answer here. The final code (amended for the newer versions of Autoit) is:

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>

Opt("GuiOnEventMode", 1)
HotKeySet("{ESC}", "QuitApp")

If Not IsDeclared("WM_WINDOWPOSCHANGED") Then Assign("WM_WINDOWPOSCHANGED",0x0047)
Global $ahGUI[4]
Global $Last_hControl = -1

Global $Frame_Color = 0xff0000;0xFF0000
Global $Frame_Width = 2
Global $hCtrl
$Main_GUI = GuiCreate("Highlight Controls Demo")
GUISetOnEvent($GUI_EVENT_CLOSE, "QuitApp")
GUIRegisterMsg($WM_WINDOWPOSCHANGED, "WM_WINDOWPOSCHANGED")


GUICtrlCreateButton("Button", 20, 20)
GUICtrlCreateCheckbox("CheckBox", 20, 60)
GUICtrlCreateEdit("", 120, 60, 240, 150)


GUICtrlCreateLabel("Info: ", 20, 250)
GUICtrlSetFont(-1, 9, 800)
$Info_Label = GUICtrlCreateLabel("", 120, 270, 250, 80)

GUISetState()

While 1
    Sleep(100)

    $hCtrl = _ControlGetHovered()

    If $hCtrl <> 0 And $Last_hControl <> $hCtrl And Not IsHighLight_GUIs($hCtrl) Then
        if not _IsPressed("1") Then
            $Last_hControl = $hCtrl
            $aCtrlPos = WinGetPos($hCtrl)

            GUICtrlSetData($Info_Label, _
                    "X = " & $aCtrlPos[0] & @CRLF & _
                    "Y = " & $aCtrlPos[1] & @CRLF & _
                    "W = " & $aCtrlPos[2] & @CRLF & _
                    "H = " & $aCtrlPos[3] & @CRLF & _
                    "Control Data = " & ControlGetText($hCtrl, "", ""))

            GUISquareDelete()
            GUICreateSquare($aCtrlPos[0], $aCtrlPos[1], $aCtrlPos[2], $aCtrlPos[3])
        EndIf
    Else
        $aNewCtrlPos = WinGetPos($hCtrl)
        for $n = 0 to 3
            if $aCtrlPos[$n] <> $aNewCtrlPos[$n] Then
                GUISquareDelete()
                $hCtrl = 0
                $Last_hControl = 0
                ExitLoop
            EndIf
        Next
    EndIf
WEnd

Func GUICreateSquare($X, $Y, $W, $H)
    $X -= $Frame_Width
    $Y -= $Frame_Width
    $W += $Frame_Width
    $H += $Frame_Width
    $ahGUI[0] = GUICreate("", $W, $Frame_Width, $X, $Y, $WS_POPUP, $WS_EX_TOPMOST+$WS_EX_TOOLWINDOW)
    GUISetBkColor($Frame_Color)

    $ahGUI[1] = GUICreate("", $Frame_Width, $H, $X, $Y, $WS_POPUP, $WS_EX_TOPMOST+$WS_EX_TOOLWINDOW)
    GUISetBkColor($Frame_Color)

    $ahGUI[2] = GUICreate("", $Frame_Width, $H, $X+$W, $Y, $WS_POPUP, $WS_EX_TOPMOST+$WS_EX_TOOLWINDOW)
    GUISetBkColor($Frame_Color)

    $ahGUI[3] = GUICreate("", $W+$Frame_Width, $Frame_Width, $X, $Y+$H, $WS_POPUP, $WS_EX_TOPMOST+$WS_EX_TOOLWINDOW)
    GUISetBkColor($Frame_Color)

    For $i = 0 To 3
        GUISetState(@SW_SHOW, $ahGUI[$i])
    Next
EndFunc

Func GUISquareDelete()
    For $i = 0 To 3
        If IsHWnd($ahGUI[$i]) And $ahGUI[$i] <> $Main_GUI Then GUIDelete($ahGUI[$i])
    Next

    $ahGUI = ""
    Dim $ahGUI[4]
EndFunc

Func IsHighLight_GUIs($hCtrl)
    For $i = 0 To 3
        If $ahGUI[$i] = $hCtrl Then Return True
    Next
    Return False
EndFunc

Func _ControlGetHovered()
    Local $aRet = DllCall("user32.dll", "int", "WindowFromPoint", "long", MouseGetPos(0), "long", MouseGetPos(1))
    If Not IsArray($aRet) Then Return SetError(1, 0, 0)
    Return HWnd($aRet[0])
EndFunc


Func WM_WINDOWPOSCHANGED($hWndGUI, $MsgID, $WParam, $LParam)
    If $hWndGUI = $Main_GUI or $hWndGUI = $hCtrl Then
        GUISquareDelete()
        $Last_hControl = -1
    Else
        Return $GUI_RUNDEFMSG
    EndIf
EndFunc

Func QuitApp()
    Exit
EndFunc

Credit to MrCreatoR and martin.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Hypertrophy

Well done Melba. Thanks a bunch. You're going to have to teach me a few searching tricks because I searched for 15 minutes! :D

Share this post


Link to post
Share on other sites
Hypertrophy

I've been trying to get it to display the red border only around the active window, have any ideas?

Share this post


Link to post
Share on other sites
FaT3oYCG

learn how to search and then search XD.


Interpreters have great power!Although they live in the shadow of compiled programming languages an interpreter can do anything that a compiled language can do, you just have to code it right.

Share this post


Link to post
Share on other sites
Melba23

coder09,

I am feeling generous today:

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

Opt("GuiOnEventMode", 1)
HotKeySet("{ESC}", "QuitApp")

If Not IsDeclared("WM_WINDOWPOSCHANGED") Then Assign("WM_WINDOWPOSCHANGED",0x0047)

Global $ahGUI[4]
Global $Frame_Color = 0xFF0000
Global $Frame_Width = 2

$Main_GUI = GuiCreate("Highlight Window Demo")
GUISetOnEvent($GUI_EVENT_CLOSE, "QuitApp")
GUIRegisterMsg($WM_WINDOWPOSCHANGED, "WM_WINDOWPOSCHANGED")

GUISetState()

Global $fSquare = False

While 1
    Sleep(100)

    If BitAND(WinGetState($Main_GUI), 8) Then
        If $fSquare = False Then
        ; Get window data
            $aWin = WinGetPos($Main_GUI)        ; X Y
            $iBorder  = _WinAPI_GetSystemMetrics(8); Border width
            $iBar    = _WinAPI_GetSystemMetrics(4); Title bar height
        ; Get Client area size
            $aCA = WinGetClientSize($Main_GUI)  ; Width, height
            GUICreateSquare($aWin[0] + $iBorder, $aWin[1] + $iBar + $iBorder, $aCA[0], $aCA[1])
            WinActivate($Main_GUI)
        EndIf
    Else
        If $fSquare = True Then GUISquareDelete()
    EndIf
WEnd

Func GUICreateSquare($X, $Y, $W, $H)
    $X -= $Frame_Width
    $Y -= $Frame_Width
    $W += $Frame_Width
    $H += $Frame_Width
    $ahGUI[0] = GUICreate("", $W, $Frame_Width, $X, $Y, $WS_POPUP, $WS_EX_TOPMOST+$WS_EX_TOOLWINDOW)
    GUISetBkColor($Frame_Color)

    $ahGUI[1] = GUICreate("", $Frame_Width, $H, $X, $Y, $WS_POPUP, $WS_EX_TOPMOST+$WS_EX_TOOLWINDOW)
    GUISetBkColor($Frame_Color)

    $ahGUI[2] = GUICreate("", $Frame_Width, $H, $X+$W, $Y, $WS_POPUP, $WS_EX_TOPMOST+$WS_EX_TOOLWINDOW)
    GUISetBkColor($Frame_Color)

    $ahGUI[3] = GUICreate("", $W+$Frame_Width, $Frame_Width, $X, $Y+$H, $WS_POPUP, $WS_EX_TOPMOST+$WS_EX_TOOLWINDOW)
    GUISetBkColor($Frame_Color)

    For $i = 0 To 3
        GUISetState(@SW_SHOW, $ahGUI[$i])
    Next
    $fSquare = True
EndFunc

Func GUISquareDelete()
    For $i = 0 To 3
        If IsHWnd($ahGUI[$i]) And $ahGUI[$i] <> $Main_GUI Then GUIDelete($ahGUI[$i])
    Next
    $ahGUI = ""
    Dim $ahGUI[4]
    $fSquare = False
EndFunc

Func WM_WINDOWPOSCHANGED($hWnd, $MsgID, $WParam, $LParam)
    If $hWnd = $Main_GUI Then
        GUISquareDelete()
    Else
        Return $GUI_RUNDEFMSG
    EndIf
EndFunc

Func QuitApp()
    Exit
EndFunc

Have fun!

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Hypertrophy

Melba, Can't thank you enough! :D

Edited by coder09

Share this post


Link to post
Share on other sites
Hypertrophy

Melba your code displays the red border around only the main gui. What I was asking is if it was possible to put the border around whatever window is currently active. Here's my attempt but its not working. Suggestions would be helpful.

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

Opt("GuiOnEventMode", 1)
HotKeySet("{ESC}", "QuitApp")

If Not IsDeclared("WM_WINDOWPOSCHANGED") Then Assign("WM_WINDOWPOSCHANGED",0x0047)

Global $ahGUI[4]
Global $Frame_Color = 0xFF0000
Global $Frame_Width = 4

$Main_GUI = GuiCreate("Highlight Window Demo")
GUISetOnEvent($GUI_EVENT_CLOSE, "QuitApp")
GUIRegisterMsg($WM_WINDOWPOSCHANGED, "WM_WINDOWPOSCHANGED")

GUISetState()

Global $fSquare = False

While 1
    Sleep(100)
    $handle = WinGetHandle("")
;~   If BitAND(WinGetState($handle), 8) Then
        If $fSquare = False Then
       ; Get window data
            $aWin = WinGetPos($handle)     ; X Y
            $iBorder  = _WinAPI_GetSystemMetrics(8); Border width
            $iBar    = _WinAPI_GetSystemMetrics(4); Title bar height
       ; Get Client area size
            $aCA = WinGetClientSize($handle)   ; Width, height
            GUICreateSquare($aWin[0]-3+ + $iBorder, $aWin[1]-3 + $iBar-21 + $iBorder, $aCA[0]+6, $aCA[1]+26)
            WinActivate($handle)
        EndIf
;~   Else
;~       If $fSquare = True Then    GUISquareDelete()
;~   EndIf
WEnd

Func GUICreateSquare($X, $Y, $W, $H)
    $X -= $Frame_Width
    $Y -= $Frame_Width
    $W += $Frame_Width
    $H += $Frame_Width
    $ahGUI[0] = GUICreate("", $W, $Frame_Width, $X, $Y, $WS_POPUP, $WS_EX_TOPMOST+$WS_EX_TOOLWINDOW)
    GUISetBkColor($Frame_Color)

    $ahGUI[1] = GUICreate("", $Frame_Width, $H, $X, $Y, $WS_POPUP, $WS_EX_TOPMOST+$WS_EX_TOOLWINDOW)
    GUISetBkColor($Frame_Color)

    $ahGUI[2] = GUICreate("", $Frame_Width, $H, $X+$W, $Y, $WS_POPUP, $WS_EX_TOPMOST+$WS_EX_TOOLWINDOW)
    GUISetBkColor($Frame_Color)

    $ahGUI[3] = GUICreate("", $W+$Frame_Width, $Frame_Width, $X, $Y+$H, $WS_POPUP, $WS_EX_TOPMOST+$WS_EX_TOOLWINDOW)
    GUISetBkColor($Frame_Color)

    For $i = 0 To 3
        GUISetState(@SW_SHOW, $ahGUI[$i])
    Next
    $fSquare = True
EndFunc

Func GUISquareDelete()
    For $i = 0 To 3
        If IsHWnd($ahGUI[$i]) And $ahGUI[$i] <> $Main_GUI Then GUIDelete($ahGUI[$i])
    Next
    $ahGUI = ""
    Dim $ahGUI[4]
    $fSquare = False
EndFunc

Func WM_WINDOWPOSCHANGED($hWnd, $MsgID, $WParam, $LParam)
    If $hWnd = $Main_GUI Then
        GUISquareDelete()
    Else
        Return $GUI_RUNDEFMSG
    EndIf
EndFunc

Func QuitApp()
    Exit
EndFunc

Share this post


Link to post
Share on other sites
MrCreatoR

Example with constant movements of the square:

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

Opt("GuiOnEventMode", 1)
HotKeySet("{ESC}", "QuitApp")

;If Not IsDeclared("WM_WINDOWPOSCHANGING") Then Assign("WM_WINDOWPOSCHANGING",0x0047)

Global $ahGUI[4]
Global $Frame_Color = 0xFF0000
Global $Frame_Width = 2

Global $iShow = True

$Main_GUI = GUICreate("Highlight Window Demo")
GUISetOnEvent($GUI_EVENT_CLOSE, "QuitApp")
GUIRegisterMsg($WM_WINDOWPOSCHANGING, "WM_WINDOWPOSCHANGING")

GUICreateSquare($Main_GUI)
GUISetState(@SW_SHOW, $Main_GUI)

While 1
    Sleep(10)
    
    If $iShow And Not WinActive($Main_GUI) Then
        For $i = 0 To 3
            GUISetState(@SW_HIDE, $ahGUI[$i])
        Next
        
        $iShow = False
    EndIf
WEnd

Func GUICreateSquare($hWnd)
    $aWin = WinGetPos($hWnd)
    
    $iBorder = _WinAPI_GetSystemMetrics(8) ; Border width
    $iBar = _WinAPI_GetSystemMetrics(4) ; Title bar height
    
    $aCA = WinGetClientSize($Main_GUI)
    
    $X = ($aWin[0] + $iBorder) - $Frame_Width
    $Y = ($aWin[1] + $iBar + $iBorder) - $Frame_Width
    $W = $aCA[0] + $Frame_Width
    $H = $aCA[1] + $Frame_Width
    
    If IsHWnd($ahGUI[0]) Then
        WinMove($ahGUI[0], "", $X, $Y)
    Else
        $ahGUI[0] = GUICreate("", $W+$iBorder, $Frame_Width, $X, $Y, $WS_POPUP, $WS_EX_TOPMOST+$WS_EX_TOOLWINDOW)
        GUISetBkColor($Frame_Color)
    EndIf
    
    If IsHWnd($ahGUI[1]) Then
        WinMove($ahGUI[1], "", $X, $Y)
    Else
        $ahGUI[1] = GUICreate("", $Frame_Width, $H+$iBorder, $X, $Y, $WS_POPUP, $WS_EX_TOPMOST+$WS_EX_TOOLWINDOW)
        GUISetBkColor($Frame_Color)
    EndIf
    
    If IsHWnd($ahGUI[2]) Then
        WinMove($ahGUI[2], "", $X+$aCA[0]+$iBorder, $Y)
    Else
        $ahGUI[2] = GUICreate("", $Frame_Width, $H+$iBorder, $X+$W, $Y, $WS_POPUP, $WS_EX_TOPMOST+$WS_EX_TOOLWINDOW)
        GUISetBkColor($Frame_Color)
    EndIf
    
    If IsHWnd($ahGUI[3]) Then
        WinMove($ahGUI[3], "", $X, $Y+$aCA[1]+$iBorder)
    Else
        $ahGUI[3] = GUICreate("", $W+$Frame_Width, $Frame_Width, $X, $Y+$H, $WS_POPUP, $WS_EX_TOPMOST+$WS_EX_TOOLWINDOW)
        GUISetBkColor($Frame_Color)
    EndIf
    
    For $i = 0 To 3
        GUISetState(@SW_SHOW, $ahGUI[$i])
    Next
    
    If Not WinActive($Main_GUI) Then
        WinActivate($Main_GUI)
        $iShow = True
    EndIf
EndFunc

Func WM_WINDOWPOSCHANGING($hWnd, $MsgID, $WParam, $LParam)
    If $hWnd = $Main_GUI Then GUICreateSquare($Main_GUI)
    
    Return $GUI_RUNDEFMSG
EndFunc

Func QuitApp()
    Exit
EndFunc

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites
Malkey

I seem to remember a topic with a similar question a while back. Try finding topics that mention the way the AutoIt window Info tool did it... Had a quick look (5minutes of searching) but nothing turned up :(

There is an example @

http://www.autoitscript.com/forum/index.ph...st&p=573462

The line "Global Const $PS_SOLID = 0" may need to be deleted or commented out.

Share this post


Link to post
Share on other sites
Melba23

coder09,

I hope this is this what you want, because I am slightly fed up of being told that my efforts are not what you want!

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

Opt("GuiOnEventMode", 1)
HotKeySet("{ESC}", "QuitApp")

If Not IsDeclared("WM_WINDOWPOSCHANGED") Then Assign("WM_WINDOWPOSCHANGED", 0x0047)

Global $ahGUI[4]
Global $Frame_Color = 0xFF0000
Global $Frame_Width = 2

$Main_GUI = GUICreate("Highlight Window Demo")
GUISetOnEvent($GUI_EVENT_CLOSE, "QuitApp")
GUIRegisterMsg($WM_WINDOWPOSCHANGED, "WM_WINDOWPOSCHANGED")

GUISetState()

Global $fSquare = False
$iCurrentActive = 0

While 1
    Sleep(100)

    $hActiveWindow = WinGetHandle("")
    If $hActiveWindow <> $iCurrentActive Then GUISquareDelete()

    If $fSquare = False Then
        ConsoleWrite("Firing" & @CRLF)
    ; Get window data
        $aWin = WinGetPos($hActiveWindow)
        GUICreateSquare($aWin[0], $aWin[1], $aWin[2], $aWin[3])
        WinActivate($hActiveWindow)
        $iCurrentActive = $hActiveWindow
    EndIf
WEnd

Func GUICreateSquare($X, $Y, $W, $H)
    $X -= $Frame_Width
    $Y -= $Frame_Width
    $W += $Frame_Width
    $H += $Frame_Width
    $ahGUI[0] = GUICreate("", $W, $Frame_Width, $X, $Y, $WS_POPUP, $WS_EX_TOPMOST + $WS_EX_TOOLWINDOW)
    GUISetBkColor($Frame_Color)

    $ahGUI[1] = GUICreate("", $Frame_Width, $H, $X, $Y, $WS_POPUP, $WS_EX_TOPMOST + $WS_EX_TOOLWINDOW)
    GUISetBkColor($Frame_Color)

    $ahGUI[2] = GUICreate("", $Frame_Width, $H, $X + $W, $Y, $WS_POPUP, $WS_EX_TOPMOST + $WS_EX_TOOLWINDOW)
    GUISetBkColor($Frame_Color)

    $ahGUI[3] = GUICreate("", $W + $Frame_Width, $Frame_Width, $X, $Y + $H, $WS_POPUP, $WS_EX_TOPMOST + $WS_EX_TOOLWINDOW)
    GUISetBkColor($Frame_Color)

    For $i = 0 To 3
        GUISetState(@SW_SHOW, $ahGUI[$i])
    Next
    $fSquare = True
EndFunc  ;==>GUICreateSquare

Func GUISquareDelete()
    For $i = 0 To 3
        If IsHWnd($ahGUI[$i]) And $ahGUI[$i] <> $Main_GUI Then GUIDelete($ahGUI[$i])
    Next
    $ahGUI = ""
    Dim $ahGUI[4]
    $fSquare = False
EndFunc  ;==>GUISquareDelete

Func WM_WINDOWPOSCHANGED($hWnd, $MsgID, $WParam, $LParam)
    If $hWnd = $Main_GUI Then
        GUISquareDelete()
    Else
        Return $GUI_RUNDEFMSG
    EndIf
EndFunc  ;==>WM_WINDOWPOSCHANGED

Func QuitApp()
    Exit
EndFunc  ;==>QuitApp

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
MrCreatoR

There is an example @

Nice one!

I hope this is this what you want

Well, there is highlighted taskbar after we deactivating our GUI...

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites
Hypertrophy

I'm getting an error on line 5 saying $PS_SOLID was previously declared as Const.

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

Global Const $PS_SOLID = 0

$hGUI = GUICreate("TEST", 320, 240, -1, -1, BitOR($WS_POPUP, $WS_SIZEBOX))
GUISetBkColor(0x000000)

GUIRegisterMsg($WM_NCPAINT, "WM_NCPAINT")

GUISetState()

Do
Until GUIGetMsg() = -3

Func WM_NCPAINT($hWnd, $Msg, $wParam, $lParam)
    Local $hDC, $hPen, $OldPen, $OldBrush, $aHwndPos
   
    $hDC = _WinAPI_GetWindowDC($hWnd)
   
    $hPen = DllCall("gdi32.dll", "hwnd", "CreatePen", "int", $PS_SOLID, "int", 5, "int", 0x0000FF)
    $hPen = $hPen[0]
   
    $OldPen = _WinAPI_SelectObject($hDC, $hPen)
    $OldBrush = _WinAPI_SelectObject($hDC, _WinAPI_GetStockObject($NULL_BRUSH))
   
    $aHwndPos = WinGetPos($hWnd)
   
    DllCall("gdi32.dll", "int", "Rectangle", "hwnd", $hDC, "int", 1, "int", 1, "int", $aHwndPos[2], "int", $aHwndPos[3])
   
    _WinAPI_SelectObject($hDC, $OldBrush)
    _WinAPI_SelectObject($hDC, $OldPen)
    _WinAPI_DeleteObject($hPen)
    _WinAPI_ReleaseDC($hWnd, $hDC)
   
    Return True
EndFunc

Share this post


Link to post
Share on other sites
MrCreatoR

I'm getting an error on line 5 saying $PS_SOLID was previously declared as Const.

So remove this line if it's already declared :D

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.