Jump to content

Tabbed Windows?


dantay9
 Share

Recommended Posts

I have a need to add tabs to a window (the whole window). Here is an example of what I mean.

I've been searching about extending a window, but couldn't get that working.

I also saw AnyGUI.au3, but I the control can't be placed outside the window.

I couldn't find an example where _WinAPI_SetWindowRgn() added to a window, only subtracted from it.

Tabs would be great, but a picture of the tabs would also be good enough.

Does anyone see a way of achieving what I am looking for?

Edited by dantay9
Link to comment
Share on other sites

It may be possible with some hard work and extreme coding.

One possibility is that you could take and draw your own GUI and seeing if there is a possibility that you can add your own controls to it as well. For an example of what I mean, check it out here: http://www.autoitscript.com/forum/index.php?showtopic=19370

Another way is that you may have to create your own DLL, C++, or some other source code file to do it yourself. But, as far as I know, there is no EASY way of accomplishing this possibility.

Spoiler

 

"...Yes, I am a criminal. My crime is that of curiosity. My crime is that of judging people by what they say and think, not what they look like.My crime is that of outsmarting you, something that you will never forgive me for." --The Mentor

"Mess with the best, die like the rest!!" -Hackers

"This above all to thine own self be true." -William Shakespeare

"Corruption is only as corrupted as the individual makes it out to be." -i386

 

style7,AutoIt.png

 

 

Link to comment
Share on other sites

Forgot to add in that the window isn't mine. It is actually supposed to be a window made by explorer.exe (when you open a folder). I don't know if it is possible to extend a window that wasn't made using autoit.

Maybe you mean something like this?

#AutoIt3Wrapper_Add_Constants=n
Opt("WInSearchChildren", 1)
#include <GUIConstantsEx.au3>
#include <windowsconstants.au3>
#include <winapi.au3>
#include <tabconstants.au3>
#include <Tabconstants.au3>
#include <guitab.au3>


ShellExecute("explorer.exe", "/e,::{20d04fe0-3aea-1069-a2d8-08002b30309d}")
Sleep(3000)
$ep = WinGetPos("My Computer")
OnAutoItExitRegister("exit1")
Global $Orig, $tab, $ch1
Example()

Func Example()
    Local $tab0, $tab0OK, $tab0input
    Local $tab1, $tab1combo, $tab1OK
    Local $tab2, $tab2OK, $msg

    $Gui = GUICreate("My GUI Tab", $ep[2] + 80, $ep[3] + 80, 100, 100, BitOR($GUI_SS_DEFAULT_GUI, $WS_CLIPCHILDREN)) ; will create a dialog box that when displayed is centered
    GUISetState()
    GUISetBkColor(0x00E0FFFF)
    GUISetFont(9, 300)


    $ch1 = GUICreate("", $ep[2], $ep[3], 11, 32, BitOR($WS_CLIPCHILDREN, $WS_CHILD), -1, $Gui)
    ;GUISetState()
    WinMove("My Computer", "", 1, 1)
    $Orig = DllCall("user32.dll", "int", "SetParent", "hwnd", WinGetHandle("My Computer"), "hwnd", $ch1)
    GUISwitch($Gui)


    $tab = GUICtrlCreateTab(10, 10, $ep[2] + 4, $ep[3] + 26)

    $tab0 = GUICtrlCreateTabItem("tab0")

    $tab1 = GUICtrlCreateTabItem("tab----1")
    GUICtrlCreateLabel("label1", 30, 80, 50, 20)
    $tab1combo = GUICtrlCreateCombo("", 20, 50, 60, 120)
    GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo", "Jon") ; default Jon
    $tab1OK = GUICtrlCreateButton("OK1", 80, 50, 50, 20)

    $tab2 = GUICtrlCreateTabItem("tab2")
    GUICtrlSetState(-1, $GUI_SHOW) ; will be display first
    GUICtrlCreateLabel("label2", 30, 80, 50, 20)
    $tab2OK = GUICtrlCreateButton("OK2", 140, 50, 50)

    GUICtrlCreateTabItem("") ; end tabitem definition

    GUISetState()
    GUIRegisterMsg($WM_NOTIFY, "On_WM_NOTIFY")

    ; Run the GUI until the dialog is closed
    While 1
    $msg = GUIGetMsg()

    If $msg = $GUI_EVENT_CLOSE Then ExitLoop

    WEnd


EndFunc ;==>Example


Func exit1()
    DllCall("user32.dll", "int", "SetParent", "hwnd", WinGetHandle("My Computer"), "hwnd", $Orig)
EndFunc ;==>exit1


Func On_WM_NOTIFY($hWnd, $msg, $wParam, $lParam)
    If $wParam = $tab Then
    Local $stNMHDR = DllStructCreate("hwnd;uint;int code", $lParam)
    Local $code = DllStructGetData($stNMHDR, "code")
    $stNMHDR = 0
    Switch $code
    Case $TCN_SELCHANGING
    If _GUICtrlTab_GetCurFocus($tab) = 0 Then
    WinSetState($ch1, "", @SW_HIDE)
    EndIf

    Case $TCN_SELCHANGE
    If _GUICtrlTab_GetCurFocus($tab) = 0 Then
    WinSetState($ch1, "", @SW_SHOW)
    EndIf
    EndSwitch

    EndIf
EndFunc ;==>On_WM_NOTIFY
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

A little closer. The rest of the tab bar needs to be transparent as well as the window. I would like it to look exactly as the picture shows. When I move the window around, the tab or picture of a tab moves with the window. In the future, I hope to be able to drag the tabs together and form a single window with tabs at the top so I can switch between windows easily. Is this past the limits of AutoIt?

Edited by dantay9
Link to comment
Share on other sites

A little closer. The rest of the tab bar needs to be transparent as well as the window. I would like it to look exactly as the picture shows. When I move the window around, the tab or picture of a tab moves with the window. In the future, I hope to be able to drag the tabs together and form a single window with tabs at the top so I can switch between windows easily. Is this past the limits of AutoIt?

I'm not sure exactly what you want because it's not obvious to me what the arrangenment is from the small picture in your first post. If it is just a tab fixed over the top of a window then my example is not the right approach.

Do you want a tab labels above a window, and when you click on a tab the window changes? If so then I don't trhink it is particularly difficult for AutoIt but it might require a few special images.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

I want to put tabs above every window opened by explorer.exe (I have the code to keep track of which windows).

The tabs will be pictures fixed above the windows from explorer.exe.

When the program is started, there will only be one tab above each window. I hope to be able to drag a tab from one window onto a tab from another window to produce this.

Then I can easily switch between folders by clicking on the tabs at the top. Thank you for your patience.

Edited by dantay9
Link to comment
Share on other sites

Did a bit of googling and I found a program that does exactly what I am looking for. It is called WindowTabs, but it uses 20,000 kb of memory on my computer. That is too much. But the effect I want is there.

This could be done in AutoIt by having a transparent popup window and the relevant pic for each tab with a label for the text. The window which has been made active or minimized can be detected best using shellhook as in Siao's code in example scripts.

But even with an AutoIt script which is compiled you will probably need around 15 Mbytes.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

I did use Siao's code to detect all windows that I want tabs on and it works great.

I have tried making it a child window, but the child doesn't move with the parent. I could look for any movement in the parent and move the child accordingly, but that would use up a lot of cpu.

Is there a style or something that will attach the popup to the parent window and have them both move together?

#include <Process.au3>
#include <Array.au3>

Global Const $HSHELL_WINDOWCREATED = 1
Global Const $HSHELL_WINDOWDESTROYED = 2
Global $WindowList = GetListOfWindows()

$GUI = GUICreate("")
GUIRegisterMsg(RegisterWindowMessage("SHELLHOOK"), "HShellWndProc")
ShellHookWindow($GUI)

While 1
    Sleep(250)
WEnd

Func OnAutoItExit()
    ShellUnhookWindow($GUI)
EndFunc ;==>OnAutoItExit

Func RegisterWindowMessage($sText)
    Local $aRet = DllCall("user32.dll", "int", "RegisterWindowMessage", "str", $sText)
    Return $aRet[0]
EndFunc ;==>RegisterWindowMessage

Func ShellHookWindow($hWnd)
    Local $aRet = DllCall("user32.dll", "int", "RegisterShellHookWindow", "hwnd", $hWnd)
    Return $aRet[0]
EndFunc ;==>ShellHookWindow

Func ShellUnhookWindow($hWnd)
    Local $aRet = DllCall("user32.dll", "int", "DeregisterShellHookWindow", "hwnd", $hWnd)
    Return $aRet[0]
EndFunc ;==>ShellUnhookWindow=

Func HShellWndProc($hWnd, $Msg, $wParam, $lParam)
    Switch $wParam
        Case $HSHELL_WINDOWCREATED
            If WinGetTitle($lParam) <> "" And IsVisible($lParam) Then
                ReDim $WindowList[UBound($WindowList, 1) + 1][UBound($WindowList, 2)]
                $WindowList[UBound($WindowList, 1) - 1][0] = WinGetTitle($lParam)
                $WindowList[UBound($WindowList, 1) - 1][1] = $lParam
                $WindowList[UBound($WindowList, 1) - 1][2] = WinGetProcess($lParam)
                $WindowList[UBound($WindowList, 1) - 1][3] = WinGetState($lParam)

                If Not IsMaximized($lParam) Then
                    ;code to add tab to window
                EndIf
            EndIf
        Case $HSHELL_WINDOWDESTROYED
            For $i = 1 To UBound($WindowList, 1) - 1
                If $WindowList[$i][1] = $lParam Then
                    _ArrayDelete($WindowList, $i)
                    ExitLoop
                EndIf
            Next
    EndSwitch
EndFunc ;==>HShellWndProc

Func GetListOfWindows()
    Local $aArray, $i = 1

    $aArray = WinList()

    ReDim $aArray[UBound($aArray, 1)][UBound($aArray, 2) + 2]
    $aArray[0][1] = "Win Handle"
    $aArray[0][2] = "PID"
    $aArray[0][3] = "Win State"

    While $i <= $aArray[0][0]
        If ($aArray[$i][0] = "") Or Not (IsVisible($aArray[$i][1])) Or (_ProcessGetName(WinGetProcess($aArray[$i][1])) <> "explorer.exe") Then
            ;only include visible windows from explorer.exe (such as open folders)
            _ArrayDelete($aArray, $i)
            $aArray[0][0] -= 1
        Else
            $aArray[$i][2] = WinGetProcess($aArray[$i][1])
            $aArray[$i][3] = WinGetState($aArray[$i][1])
            $i += 1
        EndIf
    WEnd

    Return $aArray
EndFunc ;==>GetListOfWindows

Func IsVisible($hWnd)
    Return BitAND(WinGetState($hWnd), 2)
EndFunc ;==>IsVisible

Func IsMaximized($hWnd)
    Return BitAND(WinGetState($hWnd), 32)
EndFunc ;==>IsMaximized
Edited by dantay9
Link to comment
Share on other sites

Assuming that you extend the array to have another 3 elements, then you could draw tabs something like this. (The extra elements are for the Tab handle, the graphic ID on the tab and the label ID on the tab.)

;Demo to show tab with colour and title changed after a 5s delay
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <sendmessage.au3>

Opt("GuiOnEventMode", 1)

Global $aSomeArray[2][7]

_CreateTab($aSomeArray, 1)
 _DrawTab("1. Title goes here", $aSomeArray, 1, True)
Sleep(5000)

_DrawTab("1. changes", $aSomeArray, 1, False)
Sleep(7000)

Func _CreateTab(ByRef $aInfo, $iIndex)
    If UBound($aInfo) < $iIndex Then Return -1

    If UBound($aInfo, 2) < 7 Then Return -2
    $aInfo[$iIndex][4] = GUICreate("tab" & $iIndex, 200, 28, 200, 200, $WS_POPUP, $WS_EX_LAYERED)
    GUISetBkColor(0xABCDEF)
    _API_SetLayeredWindowAttributes($aInfo[$iIndex][4], 0xABCDEF, 255);55);set special colour fully transparent

    $aInfo[$iIndex][5] = GUICtrlCreateGraphic(0, 0, 200, 28)
    GUICtrlSetOnEvent(-1, "_tabdrag")

    $aInfo[$iIndex][6] = GUICtrlCreateLabel("{}", 10, 10, 180)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetOnEvent(-1, "_tabdrag")
    GUISetState()

EndFunc ;==>_CreateTab

;draw a tab, or redraw it
Func _DrawTab($sTitle, ByRef $aInf, $iN, $bSel = True);, ByRef $eTab)
    Local $gr = $aInf[$iN][5]
    Local $iX = 0, $iY = 28, $iH = 10, $iL = 180;($iTab - 1) * 42
    Local $iTabCol
    If $sTitle <> '' Then GUICtrlSetData($aInf[$iN][6], $sTitle)
    If $bSel Then
    $iTabCol = 0xFFFF66;selected colour
    Else
    $iTabCol = 0x5577FF; unselected colour
    EndIf

;needs to be simplified
    GUICtrlSetGraphic($gr, $GUI_GR_COLOR, 0xABCDEF, 0xABCDEF)
    GUICtrlSetGraphic($gr, $GUI_GR_RECT, 0, 0, 200, 28)
    GUICtrlSetGraphic($gr, $GUI_GR_COLOR, 0x0, $iTabCol)
    GUICtrlSetGraphic($gr, $GUI_GR_MOVE, $iX, $iY - 0)
    GUICtrlSetGraphic($gr, $GUI_GR_LINE, 2 + $iX, $iY - 2)
    GUICtrlSetGraphic($gr, $GUI_GR_LINE, 2 + $iX, $iY - 10)
    GUICtrlSetGraphic($gr, $GUI_GR_LINE, 7 + $iX, $iY - 10 - $iH)
    GUICtrlSetGraphic($gr, $GUI_GR_LINE, $iL + $iX, $iY - 10 - $iH)
    GUICtrlSetGraphic($gr, $GUI_GR_LINE, $iL + 5 + $iX, $iY - 10)
    GUICtrlSetGraphic($gr, $GUI_GR_LINE, $iL + 5 + $iX, $iY - 2)
    GUICtrlSetGraphic($gr, $GUI_GR_LINE, $iL + 7 + $iX, $iY - 0)

    GUICtrlSetGraphic($gr, $GUI_GR_COLOR, 0x555555, $GUI_GR_NOBKCOLOR)
    GUICtrlSetGraphic($gr, $GUI_GR_MOVE, 0, $iY - 0)
    GUICtrlSetGraphic($gr, $GUI_GR_LINE, $iX, $iY - 0)
    GUICtrlSetGraphic($gr, $GUI_GR_MOVE, 0 + $iX, $iY - 0)
    GUICtrlSetGraphic($gr, $GUI_GR_LINE, 2 + $iX, $iY - 2)
    GUICtrlSetGraphic($gr, $GUI_GR_LINE, 2 + $iX, $iY - 10)
    GUICtrlSetGraphic($gr, $GUI_GR_LINE, 7 + $iX, $iY - 10 - $iH)
    GUICtrlSetGraphic($gr, $GUI_GR_LINE, $iL + $iX, $iY - 10 - $iH)
    GUICtrlSetGraphic($gr, $GUI_GR_LINE, $iL + 5 + $iX, $iY - 10)
    GUICtrlSetGraphic($gr, $GUI_GR_LINE, $iL + 5 + $iX, $iY - 2)
    GUICtrlSetGraphic($gr, $GUI_GR_LINE, $iL + 7 + $iX, $iY - 0)

    GUICtrlSetGraphic($gr, $GUI_GR_COLOR, 0xa3a3a3, $GUI_GR_NOBKCOLOR)
    GUICtrlSetGraphic($gr, $GUI_GR_MOVE, 7 + $iX, $iY - 9 - $iH)
    GUICtrlSetGraphic($gr, $GUI_GR_LINE, $iL + $iX, $iY - 9 - $iH)
    GUICtrlSetGraphic($gr, $GUI_GR_LINE, $iL + 4 + $iX, $iY - 10)
    GUICtrlSetGraphic($gr, $GUI_GR_LINE, $iL + 4 + $iX, $iY - 2)
    GUICtrlSetGraphic($gr, $GUI_GR_LINE, $iL + 6 + $iX, $iY - 0)

    GUICtrlSetGraphic($gr, $GUI_GR_LINE, $iL + 8 + $iX, $iY - 0)
    GUICtrlSetGraphic($gr, $GUI_GR_COLOR, 0x9555555, $GUI_GR_NOBKCOLOR)
    GUICtrlSetGraphic($gr, $GUI_GR_MOVE, $iL + 3 + $iX, $iY - 0)
    GUICtrlSetGraphic($gr, $GUI_GR_REFRESH)


EndFunc ;==>_DrawTab

Func _tabdrag()
    _SendMessage(WinGetHandle(WinGetTitle("")), $WM_SYSCOMMAND, 0xF012, 0)
 ;code here to work out which window this tab is attached to then drg that window as well
EndFunc ;==>_tabdrag


;===============================================================================
;
; Function Name: _API_SetLayeredWindowAttributes
; Description:: Sets Layered Window Attributes:) See MSDN for more informaion
; Parameter(s):
;   $hwnd - Handle of GUI to work on
;   $i_transcolor - Transparent color
;   $Transparency - Set Transparancy of GUI
;   $isColorRef - If True, $i_transcolor is a COLORREF-Strucure, else an RGB-Color
; Requirement(s): Layered Windows
; Return Value(s): Success: 1
;   Error: 0
;   @error: 1 to 3 - Error from DllCall
;   @error: 4 - Function did not succeed - use
;   _WinAPI_GetLastErrorMessage or _WinAPI_GetLastError to get more information
; Author(s):    Prog@ndy
;
;===============================================================================
;
Func _API_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $isColorRef = False)

    Local Const $AC_SRC_ALPHA = 1
    Local Const $ULW_ALPHA = 2
    Local Const $LWA_ALPHA = 0x2
    Local Const $LWA_COLORKEY = 0x1
    If Not $isColorRef Then
    $i_transcolor = Hex(String($i_transcolor), 6)
    $i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
    EndIf
    Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $LWA_COLORKEY + $LWA_ALPHA)
    Select
    Case @error
    Return SetError(@error, 0, 0)
    Case $Ret[0] = 0
    Return SetError(4, 0, 0)
    Case Else
    Return 1
    EndSelect
EndFunc ;==>_API_SetLayeredWindowAttributes

It needs the drawing to be neatend by having an array of points and a for next loop instead of all those lines but it's just for an idea.

Then you need a function to snap the tab to a window, add dragging the window with the tab and on and on it goes.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Wow. Thanks a lot.

I couldn't resist paying with this and here is a version with some ideas that might help. It doesn't use the Shellhook but again, it's just for ideas.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <sendmessage.au3>
#include <misc.au3>
#include <staticconstants.au3>

Global Const $WM_ENTERSIZEMOVE = 0x231, $WM_EXITSIZEMOVE = 0x232

Opt("GuiOnEventMode", 1)

Global $aSomeArray[2][7], $lastactive = 0

_CreateTab($aSomeArray, 1)
_DrawTab("1. Title goes here", $aSomeArray, 1, True)
ConsoleWrite($aSomeArray[1][4] & @CRLF)
While WinGetHandle("[ACTIVE]") = $aSomeArray[1][4]
    $mp = mousegetpos()
    tooltip("Click on the window for the tab",$mp[0]-50,$mp[1]+10)
    Sleep(99)
WEnd
tooltip("")

$aSomeArray[1][1] = WinGetHandle("[ACTIVE]")
_DrawTab(WinGetTitle($aSomeArray[1][1]) , $aSomeArray, 1, True)
$wp = WinGetPos("[ACTIVE]")
WinMove($aSomeArray[1][4], "", $wp[0] + 20, $wp[1] - 26)
GUIRegisterMsg($WM_MOVE, "TabMove")
GUIRegisterMsg($WM_EXITSIZEMOVE, "tabhalt")
AdlibEnable("monitormoves", 20)
While 1
    Sleep(90)
WEnd


_DrawTab("1. changes to tab title", $aSomeArray, 1, False)
Sleep(7000)

Func monitormoves()
    Local $nowActive = WinGetHandle("[ACTIVE]")
 ; If $nowActive = $lastactive Then Return

    If $nowActive <> $aSomeArray[1][1] and $nowactive <> $aSomeArray[1][4] Then
    If $lastactive = $aSomeArray[1][1] Then _Drawtab("", $aSomeArray, 1, False)
    Elseif $nowactive <> $aSomeArray[1][4] Then
    If $nowActive <> $lastactive and $lastactive <> $aSomeArray[1][4] Then
    _Drawtab("", $aSomeArray, 1, True)
                winsetontop($aSomeArray[1][4],"",1 )
                winsetontop($aSomeArray[1][4],"",0 )
    winsetontop($aSomeArray[1][1],"",1 )
                winsetontop($aSomeArray[1][1],"",0 )
            EndIf

    $wp = WinGetPos($nowActive)
    $tp = WinGetPos($aSomeArray[1][4])
    If $wp[0] <> $tp[0] - 20 Or $wp[1] <> $tp[1] + 26 Then
    WinMove($aSomeArray[1][4], "", $wp[0] + 20, $wp[1] - 26)
    EndIf

    EndIf

 $lastactive = $nowActive
 if $lastactive = $aSomeArray[1][4] and not _Ispressed(01) Then
 winactivate($aSomeArray[1][1])
 EndIf



EndFunc ;==>monitormoves


Func tabhalt($hW)
    If $hW = $aSomeArray[1][4] Then WinActivate($aSomeArray[1][1])
EndFunc ;==>tabhalt

Func tabmove($hW);,$iM,$iW,$iP)
    If $hW = $aSomeArray[1][4] Then
    $tp = WinGetPos($hW)
    WinMove($aSomeArray[1][1], "", $tp[0] - 20, $tp[1] + 26)
    EndIf

EndFunc ;==>tabmove

Func _CreateTab(ByRef $aInfo, $iIndex)
    If UBound($aInfo) < $iIndex Then Return -1

    If UBound($aInfo, 2) < 7 Then Return -2
    $aInfo[$iIndex][4] = GUICreate("tab" & $iIndex, 200, 30, 200, 200, $WS_POPUP, $WS_EX_LAYERED)
    GUISetBkColor(0xABCDEF)
    _API_SetLayeredWindowAttributes($aInfo[$iIndex][4], 0xABCDEF, 255);55);set special colour fully transparent

    $aInfo[$iIndex][5] = GUICtrlCreateGraphic(0, 0, 200, 28)
    GUICtrlSetOnEvent(-1, "_tabdrag")

    $aInfo[$iIndex][6] = GUICtrlCreateLabel("{}", 10, 6, 180,BitOr($GUI_SS_DEFAULT_LABEL,$SS_LEFTNOWORDWRAP))
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetOnEvent(-1, "_tabdrag")
    GUISetState()

EndFunc ;==>_CreateTab

;draw a tab, or redraw it
Func _DrawTab($sTitle, ByRef $aInf, $iN, $bSel = True);, ByRef $eTab)
    Local $gr = $aInf[$iN][5]
    Local $iX = 0, $iY = 26, $iH = 18, $iL = 180;($iTab - 1) * 42
    Local $iTabCol
    If $sTitle <> '' Then GUICtrlSetData($aInf[$iN][6], $sTitle)
    If $bSel Then
    $iTabCol = 0xFFFF66
    Else
    $iTabCol = 0x5577FF
    EndIf

    For $k = 1 To 2
    If $k = 1 Then
    GUICtrlSetGraphic($gr, $GUI_GR_COLOR, 0xABCDEF, 0xABCDEF)
    GUICtrlSetGraphic($gr, $GUI_GR_RECT, 0, 0, 200, 28)
    Else
    GUICtrlSetGraphic($gr, $GUI_GR_COLOR, 0x555555, $GUI_GR_NOBKCOLOR)
    EndIf

    GUICtrlSetGraphic($gr, $GUI_GR_COLOR, 0x0, $iTabCol)
    GUICtrlSetGraphic($gr, $GUI_GR_MOVE, $iX, $iY)
    GUICtrlSetGraphic($gr, $GUI_GR_LINE, 4, $iY - 4)
    GUICtrlSetGraphic($gr, $GUI_GR_LINE, 4, $iY - $iH)
    GUICtrlSetGraphic($gr, $GUI_GR_LINE, 8, 0)
    GUICtrlSetGraphic($gr, $GUI_GR_LINE, $iL, 0)
    GUICtrlSetGraphic($gr, $GUI_GR_LINE, $iL + 4, $iY - $iH)
    GUICtrlSetGraphic($gr, $GUI_GR_LINE, $iL + 4, $iY - 4)
    GUICtrlSetGraphic($gr, $GUI_GR_LINE, $iL + 8, $iY - 0)
    Next

    GUICtrlSetGraphic($gr, $GUI_GR_COLOR, 0xa3a3a3, $GUI_GR_NOBKCOLOR)
    GUICtrlSetGraphic($gr, $GUI_GR_MOVE, 9, 1)
    GUICtrlSetGraphic($gr, $GUI_GR_LINE, $iL, 1)
    GUICtrlSetGraphic($gr, $GUI_GR_LINE, $iL + 3, $iY - $iH)
    GUICtrlSetGraphic($gr, $GUI_GR_LINE, $iL + 3, $iY - 4)
    GUICtrlSetGraphic($gr, $GUI_GR_LINE, $iL + 7, $iY)


    GUICtrlSetGraphic($gr, $GUI_GR_REFRESH)


EndFunc ;==>_DrawTab

Func _tabdrag()

    if @GUI_WINHANDLE <> $lastactive then
    _Drawtab("", $aSomeArray, 1, True)
    winsetontop($aSomeArray[1][1],"",1)
    winsetontop($aSomeArray[1][1],"",0)
    endif
    _SendMessage(WinGetHandle("[ACTIVE]"), $WM_SYSCOMMAND, 0xF012, 0)
EndFunc ;==>_tabdrag


;===============================================================================
;
; Function Name: _API_SetLayeredWindowAttributes
; Description:: Sets Layered Window Attributes:) See MSDN for more informaion
; Parameter(s):
;   $hwnd - Handle of GUI to work on
;   $i_transcolor - Transparent color
;   $Transparency - Set Transparancy of GUI
;   $isColorRef - If True, $i_transcolor is a COLORREF-Strucure, else an RGB-Color
; Requirement(s): Layered Windows
; Return Value(s): Success: 1
;   Error: 0
;   @error: 1 to 3 - Error from DllCall
;   @error: 4 - Function did not succeed - use
;   _WinAPI_GetLastErrorMessage or _WinAPI_GetLastError to get more information
; Author(s):    Prog@ndy
;
;===============================================================================
;
Func _API_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $isColorRef = False)

    Local Const $AC_SRC_ALPHA = 1
    Local Const $ULW_ALPHA = 2
    Local Const $LWA_ALPHA = 0x2
    Local Const $LWA_COLORKEY = 0x1
    If Not $isColorRef Then
    $i_transcolor = Hex(String($i_transcolor), 6)
    $i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
    EndIf
    Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $LWA_COLORKEY + $LWA_ALPHA)
    Select
    Case @error
    Return SetError(@error, 0, 0)
    Case $Ret[0] = 0
    Return SetError(4, 0, 0)
    Case Else
    Return 1
    EndSelect
EndFunc ;==>_API_SetLayeredWindowAttributes
Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...