Sign in to follow this  
Followers 0
katoNkatoNK

Trouble adding a png

7 posts in this topic

#1 ·  Posted (edited)

I'm having trouble getting the png to show up,iv'e gone over the example used from the helpfile in my script along with all the topics i could find.

I'm guessing that its something simple i missed.

could someone plz take a look?

Edit

Ignore the png problem :unsure:

i just had to move a few things around..

i still have these questions tho:

-if it's possible add the style $GUI_WS_EX_PARENTDRAG to the png how would i do that

-and if i wanted to add a png to another gui later would i just need to repeat the method?

->and where do i change the placement of the png/gui to make the png on the outside of the gui, so to make a border as in the png...

(attachment includes the png)

coNfig.rar

Edited by katoNkatoNK

Share this post


Link to post
Share on other sites



I hope this will answer your questions:

#include <Array.au3>
#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <ButtonConstants.au3>
#include <GDIPlus.au3>
#Include <WinAPI.au3>

Opt('MustDeclareVars', 1)
Opt('TrayMenuMode', 3)
Opt('TrayAutoPause', 0)

Global $gui, $gui_child, $msg, $ePath
Global $tab0, $tab1, $tab2, $tab3, $tab4, $tab_end
Global Const $SC_DRAGMOVE = 0xF012
Global $varFile = @ScriptDir & '\Variables.inc'
Global $varRead = IniReadSection($varFile, "Variables")
Global $varRefresh = IniRead($varFile, "Variables", "Command", "")
Global $Editor = IniRead($varFile, "Variables", "Editor", "C:\Windows\NotePad.exe")
Global $prompt_yn = 0
Global $ffList, $fiList, $ffPath, $fiPath, $ffBrowse, $fiBrowse, $ffRead, $fiRead, $fPathBrowse, $fIconBrowse, $FolderPath[13], $FiconPath[13]
Global $afList, $aiList, $afPath, $aiPath, $afBrowse, $aiBrowse, $afRead, $aiRead, $aPathBrowse, $aIconBrowse, $AppPath[13], $aIconPath[13]
Global $guiImage, $hGraphic

coNfig()

Func coNfig()
    Local $value
    Local $gResources, $gVariables, $gsave, $grefresh
    Local $eBrowse, $EditorBrowse
    Local $tMsg, $tMenu, $tResources, $tVariables, $tStyles, $tAbout, $tExit

    If IsArray($varRead) Then
        For $i = 1 To UBound($varRead) - 1
            $FolderPath[StringRegExpReplace($varRead[$i][0], "(?i)Fpath", "")] = $varRead[$i][1]
        Next
    EndIf
    If IsArray($varRead) Then
        For $i = 1 To UBound($varRead) - 1
            $FiconPath[StringRegExpReplace($varRead[$i][0], "(?i)Ficon", "")] = $varRead[$i][1]
        Next
    EndIf

_GDIPlus_StartUp()
$guiImage   = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\coNfig.png")
$gui = GUICreate("", 400, 290, -1, -1, $WS_POPUP, $WS_EX_LAYERED)
SetTransparentBitmap($gui, $guiImage)
_GDIPlus_ShutDown()

$gui_child = GUICreate("coNfig", 384, 246, 10, 37, $WS_POPUP, $WS_EX_MDICHILD, $gui)

    GUISetState(@SW_SHOW, $gui)
    GUISetState(@SW_SHOW, $gui_child)
;~  GUISwitch($gui_child)

    GUICtrlCreateGroup("Resources", 10, 145, 270, 55)
    GUICtrlSetFont(-1, 6, 400, 0, "hooge 05_53")
$gResources = GUICtrlCreateButton("Open..", 23, 163, 50)
    GUICtrlSetFont($gResources, 6, 400, 0, "hooge 05_53")
$gVariables = GUICtrlCreateButton("Var.inc", 82, 163, 50)
    GUICtrlSetFont($gVariables, 6, 400, 0, "hooge 05_53")
$gsave = GUICtrlCreateButton("Save", 295, 150, 55, 23)
$grefresh = GUICtrlCreateButton("Refresh", 295, 177, 55, 23)
    GUICtrlCreateTab(10, 10, 350, 130)

    ;<Folders
    $tab0 = GUICtrlCreateTabItem("Folders")

    GUICtrlCreateLabel("Folder:", 20, 50)
$ffList = GUICtrlCreateCombo("1", 60, 48, 35)
    GUICtrlSetData(-1, "2|3|4|5|6|7|8|9|10|11|12")
$ffPath = GUICtrlCreateInput("", 105, 48, 200)
$value = $FolderPath[GUICtrlRead($ffList)]
If $value = "" Then $value = "Path.   .   .   .   .   .   .   .   .   .   . [ browse>"
    GUICtrlSetData($ffPath, $value)
$ffBrowse = GUICtrlCreateButton("...", 315, 47, 30, 22)

    GUICtrlCreateLabel("Icon:", 28, 100)
$fiList = GUICtrlCreateCombo("1", 60, 98, 35)
    GUICtrlSetData(-1, "2|3|4|5|6|7|8|9|10|11|12")
$fiPath = GUICtrlCreateInput("", 105, 98, 200)
$value = $FiconPath[GUICtrlRead($fiList)]
    If $value = "" Then $value = "Icon.   .   .   .   .   .   .   .   .   .   . [ browse>"
    GUICtrlSetData($fiPath, $value)
$fiBrowse = GUICtrlCreateButton("...", 315, 97, 30, 22)
    ;Folders/>

    ;<Apps
    $tab1 = GUICtrlCreateTabItem("Apps")

    GUICtrlCreateLabel("App:", 20, 50)
$afList = GUICtrlCreateCombo("1", 60, 48, 35)
    GUICtrlSetData(-1, "2|3|4|5|6|7|8|9|10|11|12")
$afPath = GUICtrlCreateInput("", 105, 48, 200)
$value = $AppPath[GUICtrlRead($afList)]
If $value = "" Then $value = "Path.   .   .   .   .   .   .   .   .   .   . [ browse>"
    GUICtrlSetData($afPath, $value)
$afBrowse = GUICtrlCreateButton("...", 315, 47, 30, 22)

    GUICtrlCreateLabel("Icon:", 28, 100)
$aiList = GUICtrlCreateCombo("1", 60, 98, 35)
    GUICtrlSetData(-1, "2|3|4|5|6|7|8|9|10|11|12")
$aiPath = GUICtrlCreateInput("", 105, 98, 200)
$value = $AiconPath[GUICtrlRead($aiList)]
    If $value = "" Then $value = "Icon.   .   .   .   .   .   .   .   .   .   . [ browse>"
    GUICtrlSetData($aiPath, $value)
$aiBrowse = GUICtrlCreateButton("...", 315, 97, 30, 22)
    ;Apps/>

    ;<Drives
    $tab2 = GUICtrlCreateTabItem("Drives")
    ;Drives/>

    ;<System
    $tab3 = GUICtrlCreateTabItem("System")
    ;System/>

    ;<Editor
    $tab4 = GUICtrlCreateTabItem("Editor")
$ePath = GUICtrlCreateInput("", 25, 50, 270)
If $Editor = "" Then $Editor = "Default File Editor Path .  .  ."
    GUICtrlSetData($ePath, $Editor)
$eBrowse = GUICtrlCreateButton("...", 310, 49, 30, 24)
    GUICtrlCreateLabel("Browse or Enter the Editor's path manually." & @CRLF & "Choose the Default Editor with which the skin's resource files will open with - 'Var.inc', 'Styles.inc'", 35, 85, 290, 40, $SS_CENTER)
    ;Editor/>

    $tab_end = GUICtrlCreateTabItem("");

    GUICtrlSetState($tab0, $GUI_SHOW)

    ;<Tray
    $tMenu = TrayCreateMenu("Resources")
$tResources = TrayCreateItem("Open..", $tMenu)
    TrayCreateItem("", $tMenu)
$tVariables = TrayCreateItem("Variables", $tMenu)
$tStyles = TrayCreateItem("Styles", $tMenu)
    TrayCreateItem("")
$tAbout = TrayCreateItem("About")
    TrayCreateItem("")
$tExit = TrayCreateItem("Exit")
    ;Tray/>
    TraySetState(2)
    TraySetClick(24)
    GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
;~  GUIRegisterMsg($WM_PAINT, "MY_WM_PAINT")

GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN")

    While 1
        ;<Gui>
        $msg = GUIGetMsg()
        Switch $msg
            Case $GUI_EVENT_CLOSE
                If $prompt_yn > 0 Then Prompt()
                If $prompt_yn < 1 Then Exit
            Case $GUI_EVENT_MINIMIZE
                GUISetState(@SW_MINIMIZE)
                GUISetState(@SW_HIDE)
                TraySetState()
            Case $eBrowse
                $EditorBrowse = FileOpenDialog("Select Default Editor", @ScriptDir, "EXE (*.EXE)")
                If Not @error Then
                    GUICtrlSetData($ePath, $EditorBrowse)
                    $prompt_yn = 1
                EndIf
            Case $ffBrowse
                $ffRead = GUICtrlRead($ffList)
                $fPathBrowse = FileSelectFolder("Folder " & $ffRead & " path...", "")
                If Not @error Then
                    GUICtrlSetData($ffPath, $fPathBrowse)
                    $FolderPath[GUICtrlRead($ffList)] = $fPathBrowse
                    $prompt_yn = 1
                EndIf
            Case $fiBrowse
                $fiRead = GUICtrlRead($fiList)
                $fIconBrowse = FileOpenDialog("Icon " & $fiRead & " path...", @ScriptDir, "PNG (*.PNG)")
                If Not @error Then
                    GUICtrlSetData($fiPath, $fIconBrowse)
                    $FiconPath[GUICtrlRead($fiList)] = $fIconBrowse
                    $prompt_yn = 1
                EndIf
            Case $ffList
                $value = $FolderPath[GUICtrlRead($ffList)]
                If $value = "" Then $value = "Path.   .   .   .   .   .   .   .   .   .   . [ browse>"
                GUICtrlSetData($ffPath, $value)
            Case $fiList
                $value = $FiconPath[GUICtrlRead($fiList)]
                If $value = "" Then $value = "Icon.   .   .   .   .   .   .   .   .   .   . [ browse>"
                GUICtrlSetData($fiPath, $value)
            Case $gResources
                ShellExecute(@ScriptDir)
            Case $gVariables
                $Editor = IniRead($varFile, "Variables", "Editor", "C:\Windows\NotePad.exe")
                ShellExecute($Editor, @ScriptDir & '\Variables.inc', "")
            Case $gsave
                $prompt_yn = 0
                WriteINI()
            Case $grefresh
                ShellExecute("refresh.exe", $varRefresh)
        EndSwitch
        ;<Tray>
        $tMsg = TrayGetMsg()
        Switch $tMsg
            Case $tResources
                ShellExecute(@ScriptDir)
            Case $tVariables
                $Editor = IniRead($varFile, "Variables", "Editor", "C:\Windows\NotePad.exe")
                ShellExecute($Editor, @ScriptDir & '\Variables.inc', "")
            Case $tAbout
                About()
            Case $TRAY_EVENT_PRIMARYUP
                GUISetState(@SW_SHOWNORMAL)
                WinActivate($gui)
                TraySetState(2)
            Case $tExit
                Exit
        EndSwitch
    WEnd
EndFunc     ;==>coNfig

Func MY_WM_PAINT($hWnd, $Msg, $wParam, $lParam)
    _WinAPI_RedrawWindow($gui, 0, 0, $RDW_UPDATENOW)
    _GDIPlus_GraphicsDrawImage($hGraphic, $guiImage, 0, 0)
    _WinAPI_RedrawWindow($gui, 0, 0, $RDW_VALIDATE)
    Return $GUI_RUNDEFMSG
EndFunc

Func WriteINI()

    IniWrite($varFile, "Variables", "Editor", GUICtrlRead($ePath))

    For $i = 1 To 12
        IniWrite($varFile, "Variables", "Fpath" & $i, $FolderPath[$i])
    Next
    For $i = 1 To 12
        IniWrite($varFile, "Variables", "Ficon" & $i, $FiconPath[$i])
    Next
EndFunc     ;==>WriteINI

Func WM_COMMAND($hWnd, $msg, $wParam, $lParam)
    Local $chk = BitAND($wParam, 0x0000FFFF)

    Switch $chk
        Case $ffPath
            If FileExists(GUICtrlRead($ffPath)) Then
                $FolderPath[GUICtrlRead($ffList)] = GUICtrlRead($ffPath)
                GUICtrlSetBkColor($ffPath, 0xFFFFFFFF)
            Else
                GUICtrlSetBkColor($ffPath, 0xFF3333)
            EndIf
        Case $fiPath
            If FileExists(GUICtrlRead($fiPath)) Then
                $FiconPath[GUICtrlRead($fiList)] = GUICtrlRead($fiPath)
                GUICtrlSetBkColor($fiPath, 0xFFFFFFFF)
            Else
                GUICtrlSetBkColor($fiPath, 0xFF3333)
            EndIf
    EndSwitch
EndFunc     ;==>WM_COMMAND

Func Prompt()
    Local $promptbox

$promptbox = MsgBox(4, "Exit", "Without saving?")
    If $promptbox = 6 Then Exit
    If $promptbox = 7 Then Return
EndFunc     ;==>Prompt

Func About()
    Local $gLink, $gBTN, $bStartUp, $bStatus

    GUICreate("About", 210, 120, -1, -1)
$gLink = GUICtrlCreateLabel("CC BY-NC-SA" & @CRLF & "katoNkatoNK.deviantart.com", 20, 27, 170, 35, $SS_CENTER)
    GuiCtrlCreateGroup("About", 17, 10, 176, 55)
$bStartUp = GUICtrlCreateCheckbox("Add/Remove", 30, 84)
    GUICtrlCreateGroup("Run at Startup", 17, 70, 110, 40)
$gBTN = GUICtrlCreateButton("Close", 142, 80, 50, 26)

    GUISetState()

    While 1
        $msg = GUIGetMsg()
        $bStatus = GUICtrlRead($bStartUp)
        Switch $msg
            Case $gLink
                ShellExecute("http://katoNkatoNk.deviantart.com")
            Case $bStartUp
                If $bStatus = $GUI_CHECKED Then
                    RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "coNfig")
                    If Not @error Then
                        RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "coNfig", "REG_SZ", @ScriptDir & '\coNfig.exe')
                    EndIf
                EndIf
                If $bStatus = $GUI_UNCHECKED Then
                    RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "coNfig")
                    If Not @error Then
                        RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "coNfig")
                    EndIf
                EndIf
            Case $gBTN
                GUIDelete()
                ExitLoop
        EndSwitch
    WEnd
EndFunc     ;==>About

Func _WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam)
    _SendMessage($gui, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0)
EndFunc   ;==>_WM_LBUTTONDOWN

Func SetTransparentBitmap($hGUI, $hImage, $iOpacity = 0xFF)
    Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend
    $hScrDC = _WinAPI_GetDC(0)
    $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC)
    $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
    $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap)
    $tSize = DllStructCreate($tagSIZE)
    $pSize = DllStructGetPtr($tSize)
    DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage))
    DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage))
    $tSource = DllStructCreate($tagPOINT)
    $pSource = DllStructGetPtr($tSource)
    $tBlend = DllStructCreate($tagBLENDFUNCTION)
    $pBlend = DllStructGetPtr($tBlend)
    DllStructSetData($tBlend, "Alpha", $iOpacity)
    DllStructSetData($tBlend, "Format", 1)
    _WinAPI_UpdateLayeredWindow($hGUI,  $hMemDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)
    _WinAPI_ReleaseDC(0, $hScrDC)
    _WinAPI_SelectObject($hMemDC, $hOld)
    _WinAPI_DeleteObject($hBitmap)
    _WinAPI_DeleteDC($hMemDC)
EndFunc   ;==>SetTransparentBitmap

First resize the png image to dimension 398x288 then start the script.

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

I hope this will answer your questions:

#include <Array.au3>
#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <ButtonConstants.au3>
#include <GDIPlus.au3>
#Include <WinAPI.au3>

Opt('MustDeclareVars', 1)
Opt('TrayMenuMode', 3)
Opt('TrayAutoPause', 0)

Global $gui, $gui_child, $msg, $ePath
Global $tab0, $tab1, $tab2, $tab3, $tab4, $tab_end
Global Const $SC_DRAGMOVE = 0xF012
Global $varFile = @ScriptDir & '\Variables.inc'
Global $varRead = IniReadSection($varFile, "Variables")
Global $varRefresh = IniRead($varFile, "Variables", "Command", "")
Global $Editor = IniRead($varFile, "Variables", "Editor", "C:\Windows\NotePad.exe")
Global $prompt_yn = 0
Global $ffList, $fiList, $ffPath, $fiPath, $ffBrowse, $fiBrowse, $ffRead, $fiRead, $fPathBrowse, $fIconBrowse, $FolderPath[13], $FiconPath[13]
Global $afList, $aiList, $afPath, $aiPath, $afBrowse, $aiBrowse, $afRead, $aiRead, $aPathBrowse, $aIconBrowse, $AppPath[13], $aIconPath[13]
Global $guiImage, $hGraphic

coNfig()

Func coNfig()
    Local $value
    Local $gResources, $gVariables, $gsave, $grefresh
    Local $eBrowse, $EditorBrowse
    Local $tMsg, $tMenu, $tResources, $tVariables, $tStyles, $tAbout, $tExit

    If IsArray($varRead) Then
        For $i = 1 To UBound($varRead) - 1
            $FolderPath[StringRegExpReplace($varRead[$i][0], "(?i)Fpath", "")] = $varRead[$i][1]
        Next
    EndIf
    If IsArray($varRead) Then
        For $i = 1 To UBound($varRead) - 1
            $FiconPath[StringRegExpReplace($varRead[$i][0], "(?i)Ficon", "")] = $varRead[$i][1]
        Next
    EndIf

_GDIPlus_StartUp()
$guiImage   = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\coNfig.png")
$gui = GUICreate("", 400, 290, -1, -1, $WS_POPUP, $WS_EX_LAYERED)
SetTransparentBitmap($gui, $guiImage)
_GDIPlus_ShutDown()

$gui_child = GUICreate("coNfig", 384, 246, 10, 37, $WS_POPUP, $WS_EX_MDICHILD, $gui)

    GUISetState(@SW_SHOW, $gui)
    GUISetState(@SW_SHOW, $gui_child)
;~  GUISwitch($gui_child)

    GUICtrlCreateGroup("Resources", 10, 145, 270, 55)
    GUICtrlSetFont(-1, 6, 400, 0, "hooge 05_53")
$gResources = GUICtrlCreateButton("Open..", 23, 163, 50)
    GUICtrlSetFont($gResources, 6, 400, 0, "hooge 05_53")
$gVariables = GUICtrlCreateButton("Var.inc", 82, 163, 50)
    GUICtrlSetFont($gVariables, 6, 400, 0, "hooge 05_53")
$gsave = GUICtrlCreateButton("Save", 295, 150, 55, 23)
$grefresh = GUICtrlCreateButton("Refresh", 295, 177, 55, 23)
    GUICtrlCreateTab(10, 10, 350, 130)

    ;<Folders
    $tab0 = GUICtrlCreateTabItem("Folders")

    GUICtrlCreateLabel("Folder:", 20, 50)
$ffList = GUICtrlCreateCombo("1", 60, 48, 35)
    GUICtrlSetData(-1, "2|3|4|5|6|7|8|9|10|11|12")
$ffPath = GUICtrlCreateInput("", 105, 48, 200)
$value = $FolderPath[GUICtrlRead($ffList)]
If $value = "" Then $value = "Path.   .   .   .   .   .   .   .   .   .   . [ browse>"
    GUICtrlSetData($ffPath, $value)
$ffBrowse = GUICtrlCreateButton("...", 315, 47, 30, 22)

    GUICtrlCreateLabel("Icon:", 28, 100)
$fiList = GUICtrlCreateCombo("1", 60, 98, 35)
    GUICtrlSetData(-1, "2|3|4|5|6|7|8|9|10|11|12")
$fiPath = GUICtrlCreateInput("", 105, 98, 200)
$value = $FiconPath[GUICtrlRead($fiList)]
    If $value = "" Then $value = "Icon.   .   .   .   .   .   .   .   .   .   . [ browse>"
    GUICtrlSetData($fiPath, $value)
$fiBrowse = GUICtrlCreateButton("...", 315, 97, 30, 22)
    ;Folders/>

    ;<Apps
    $tab1 = GUICtrlCreateTabItem("Apps")

    GUICtrlCreateLabel("App:", 20, 50)
$afList = GUICtrlCreateCombo("1", 60, 48, 35)
    GUICtrlSetData(-1, "2|3|4|5|6|7|8|9|10|11|12")
$afPath = GUICtrlCreateInput("", 105, 48, 200)
$value = $AppPath[GUICtrlRead($afList)]
If $value = "" Then $value = "Path.   .   .   .   .   .   .   .   .   .   . [ browse>"
    GUICtrlSetData($afPath, $value)
$afBrowse = GUICtrlCreateButton("...", 315, 47, 30, 22)

    GUICtrlCreateLabel("Icon:", 28, 100)
$aiList = GUICtrlCreateCombo("1", 60, 98, 35)
    GUICtrlSetData(-1, "2|3|4|5|6|7|8|9|10|11|12")
$aiPath = GUICtrlCreateInput("", 105, 98, 200)
$value = $AiconPath[GUICtrlRead($aiList)]
    If $value = "" Then $value = "Icon.   .   .   .   .   .   .   .   .   .   . [ browse>"
    GUICtrlSetData($aiPath, $value)
$aiBrowse = GUICtrlCreateButton("...", 315, 97, 30, 22)
    ;Apps/>

    ;<Drives
    $tab2 = GUICtrlCreateTabItem("Drives")
    ;Drives/>

    ;<System
    $tab3 = GUICtrlCreateTabItem("System")
    ;System/>

    ;<Editor
    $tab4 = GUICtrlCreateTabItem("Editor")
$ePath = GUICtrlCreateInput("", 25, 50, 270)
If $Editor = "" Then $Editor = "Default File Editor Path .  .  ."
    GUICtrlSetData($ePath, $Editor)
$eBrowse = GUICtrlCreateButton("...", 310, 49, 30, 24)
    GUICtrlCreateLabel("Browse or Enter the Editor's path manually." & @CRLF & "Choose the Default Editor with which the skin's resource files will open with - 'Var.inc', 'Styles.inc'", 35, 85, 290, 40, $SS_CENTER)
    ;Editor/>

    $tab_end = GUICtrlCreateTabItem("");

    GUICtrlSetState($tab0, $GUI_SHOW)

    ;<Tray
    $tMenu = TrayCreateMenu("Resources")
$tResources = TrayCreateItem("Open..", $tMenu)
    TrayCreateItem("", $tMenu)
$tVariables = TrayCreateItem("Variables", $tMenu)
$tStyles = TrayCreateItem("Styles", $tMenu)
    TrayCreateItem("")
$tAbout = TrayCreateItem("About")
    TrayCreateItem("")
$tExit = TrayCreateItem("Exit")
    ;Tray/>
    TraySetState(2)
    TraySetClick(24)
    GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
;~  GUIRegisterMsg($WM_PAINT, "MY_WM_PAINT")

GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN")

    While 1
        ;<Gui>
        $msg = GUIGetMsg()
        Switch $msg
            Case $GUI_EVENT_CLOSE
                If $prompt_yn > 0 Then Prompt()
                If $prompt_yn < 1 Then Exit
            Case $GUI_EVENT_MINIMIZE
                GUISetState(@SW_MINIMIZE)
                GUISetState(@SW_HIDE)
                TraySetState()
            Case $eBrowse
                $EditorBrowse = FileOpenDialog("Select Default Editor", @ScriptDir, "EXE (*.EXE)")
                If Not @error Then
                    GUICtrlSetData($ePath, $EditorBrowse)
                    $prompt_yn = 1
                EndIf
            Case $ffBrowse
                $ffRead = GUICtrlRead($ffList)
                $fPathBrowse = FileSelectFolder("Folder " & $ffRead & " path...", "")
                If Not @error Then
                    GUICtrlSetData($ffPath, $fPathBrowse)
                    $FolderPath[GUICtrlRead($ffList)] = $fPathBrowse
                    $prompt_yn = 1
                EndIf
            Case $fiBrowse
                $fiRead = GUICtrlRead($fiList)
                $fIconBrowse = FileOpenDialog("Icon " & $fiRead & " path...", @ScriptDir, "PNG (*.PNG)")
                If Not @error Then
                    GUICtrlSetData($fiPath, $fIconBrowse)
                    $FiconPath[GUICtrlRead($fiList)] = $fIconBrowse
                    $prompt_yn = 1
                EndIf
            Case $ffList
                $value = $FolderPath[GUICtrlRead($ffList)]
                If $value = "" Then $value = "Path.   .   .   .   .   .   .   .   .   .   . [ browse>"
                GUICtrlSetData($ffPath, $value)
            Case $fiList
                $value = $FiconPath[GUICtrlRead($fiList)]
                If $value = "" Then $value = "Icon.   .   .   .   .   .   .   .   .   .   . [ browse>"
                GUICtrlSetData($fiPath, $value)
            Case $gResources
                ShellExecute(@ScriptDir)
            Case $gVariables
                $Editor = IniRead($varFile, "Variables", "Editor", "C:\Windows\NotePad.exe")
                ShellExecute($Editor, @ScriptDir & '\Variables.inc', "")
            Case $gsave
                $prompt_yn = 0
                WriteINI()
            Case $grefresh
                ShellExecute("refresh.exe", $varRefresh)
        EndSwitch
        ;<Tray>
        $tMsg = TrayGetMsg()
        Switch $tMsg
            Case $tResources
                ShellExecute(@ScriptDir)
            Case $tVariables
                $Editor = IniRead($varFile, "Variables", "Editor", "C:\Windows\NotePad.exe")
                ShellExecute($Editor, @ScriptDir & '\Variables.inc', "")
            Case $tAbout
                About()
            Case $TRAY_EVENT_PRIMARYUP
                GUISetState(@SW_SHOWNORMAL)
                WinActivate($gui)
                TraySetState(2)
            Case $tExit
                Exit
        EndSwitch
    WEnd
EndFunc     ;==>coNfig

Func MY_WM_PAINT($hWnd, $Msg, $wParam, $lParam)
    _WinAPI_RedrawWindow($gui, 0, 0, $RDW_UPDATENOW)
    _GDIPlus_GraphicsDrawImage($hGraphic, $guiImage, 0, 0)
    _WinAPI_RedrawWindow($gui, 0, 0, $RDW_VALIDATE)
    Return $GUI_RUNDEFMSG
EndFunc

Func WriteINI()

    IniWrite($varFile, "Variables", "Editor", GUICtrlRead($ePath))

    For $i = 1 To 12
        IniWrite($varFile, "Variables", "Fpath" & $i, $FolderPath[$i])
    Next
    For $i = 1 To 12
        IniWrite($varFile, "Variables", "Ficon" & $i, $FiconPath[$i])
    Next
EndFunc     ;==>WriteINI

Func WM_COMMAND($hWnd, $msg, $wParam, $lParam)
    Local $chk = BitAND($wParam, 0x0000FFFF)

    Switch $chk
        Case $ffPath
            If FileExists(GUICtrlRead($ffPath)) Then
                $FolderPath[GUICtrlRead($ffList)] = GUICtrlRead($ffPath)
                GUICtrlSetBkColor($ffPath, 0xFFFFFFFF)
            Else
                GUICtrlSetBkColor($ffPath, 0xFF3333)
            EndIf
        Case $fiPath
            If FileExists(GUICtrlRead($fiPath)) Then
                $FiconPath[GUICtrlRead($fiList)] = GUICtrlRead($fiPath)
                GUICtrlSetBkColor($fiPath, 0xFFFFFFFF)
            Else
                GUICtrlSetBkColor($fiPath, 0xFF3333)
            EndIf
    EndSwitch
EndFunc     ;==>WM_COMMAND

Func Prompt()
    Local $promptbox

$promptbox = MsgBox(4, "Exit", "Without saving?")
    If $promptbox = 6 Then Exit
    If $promptbox = 7 Then Return
EndFunc     ;==>Prompt

Func About()
    Local $gLink, $gBTN, $bStartUp, $bStatus

    GUICreate("About", 210, 120, -1, -1)
$gLink = GUICtrlCreateLabel("CC BY-NC-SA" & @CRLF & "katoNkatoNK.deviantart.com", 20, 27, 170, 35, $SS_CENTER)
    GuiCtrlCreateGroup("About", 17, 10, 176, 55)
$bStartUp = GUICtrlCreateCheckbox("Add/Remove", 30, 84)
    GUICtrlCreateGroup("Run at Startup", 17, 70, 110, 40)
$gBTN = GUICtrlCreateButton("Close", 142, 80, 50, 26)

    GUISetState()

    While 1
        $msg = GUIGetMsg()
        $bStatus = GUICtrlRead($bStartUp)
        Switch $msg
            Case $gLink
                ShellExecute("http://katoNkatoNk.deviantart.com")
            Case $bStartUp
                If $bStatus = $GUI_CHECKED Then
                    RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "coNfig")
                    If Not @error Then
                        RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "coNfig", "REG_SZ", @ScriptDir & '\coNfig.exe')
                    EndIf
                EndIf
                If $bStatus = $GUI_UNCHECKED Then
                    RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "coNfig")
                    If Not @error Then
                        RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "coNfig")
                    EndIf
                EndIf
            Case $gBTN
                GUIDelete()
                ExitLoop
        EndSwitch
    WEnd
EndFunc     ;==>About

Func _WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam)
    _SendMessage($gui, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0)
EndFunc   ;==>_WM_LBUTTONDOWN

Func SetTransparentBitmap($hGUI, $hImage, $iOpacity = 0xFF)
    Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend
    $hScrDC = _WinAPI_GetDC(0)
    $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC)
    $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
    $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap)
    $tSize = DllStructCreate($tagSIZE)
    $pSize = DllStructGetPtr($tSize)
    DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage))
    DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage))
    $tSource = DllStructCreate($tagPOINT)
    $pSource = DllStructGetPtr($tSource)
    $tBlend = DllStructCreate($tagBLENDFUNCTION)
    $pBlend = DllStructGetPtr($tBlend)
    DllStructSetData($tBlend, "Alpha", $iOpacity)
    DllStructSetData($tBlend, "Format", 1)
    _WinAPI_UpdateLayeredWindow($hGUI,  $hMemDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)
    _WinAPI_ReleaseDC(0, $hScrDC)
    _WinAPI_SelectObject($hMemDC, $hOld)
    _WinAPI_DeleteObject($hBitmap)
    _WinAPI_DeleteDC($hMemDC)
EndFunc   ;==>SetTransparentBitmap

First resize the png image to dimension 398x288 then start the script.

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Wow..lol, Much appreciated man!!

That definately answered my questions! :unsure:

Config:

post-64124-0-02313000-1302644823_thumb.j

Edited by katoNkatoNK

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Sori if it's asking a lot, but is it possible to add the aero effect to just the png in my config?

-

-Aero Example script by Yashied

i've tried and whenever i add the aero effect to the 'hidden' gui which is made for the png frame's image the effect works on the png although with square corners, but the rest of the config turns black and flickers...

(I would ask how to get the 'entire' background aero'd but i dont think it's possible while having tabs in the window :?)

The attachment is my script with the aero functions inside:

Aero.rar

Edited by katoNkatoNK

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Try this:

#include <Array.au3>
#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <ButtonConstants.au3>
#include <GDIPlus.au3>
#Include <WinAPI.au3>

;~ Opt('MustDeclareVars', 1)
Opt('TrayMenuMode', 3)
Opt('TrayAutoPause', 0)

Global $gui, $gui_child, $msg, $ePath
Global $tab0, $tab1, $tab2, $tab3, $tab4, $tab_end
Global Const $SC_DRAGMOVE = 0xF012
Global $varFile = @ScriptDir & '\Variables.inc'
Global $varRead = IniReadSection($varFile, "Variables")
Global $varRefresh = IniRead($varFile, "Variables", "Command", "")
Global $Editor = IniRead($varFile, "Variables", "Editor", "C:\Windows\NotePad.exe")
Global $prompt_yn = 0
Global $ffList, $fiList, $ffPath, $fiPath, $ffBrowse, $fiBrowse, $ffRead, $fiRead, $fPathBrowse, $fIconBrowse, $FolderPath[13], $FiconPath[13]
Global $afList, $aiList, $afPath, $aiPath, $afBrowse, $aiBrowse, $afRead, $aiRead, $aPathBrowse, $aIconBrowse, $AppPath[13], $aIconPath[13]
Global $guiImage, $hGraphic
 Global $Struct = DllStructCreate("int cxLeftWidth;int cxRightWidth;int cyTopHeight;int cyBottomHeight;")
 Global $sStruct = DllStructCreate("dword;int;ptr;int")
coNfig()

Func coNfig()
    Local $value
    Local $gResources, $gVariables, $gsave, $grefresh
    Local $eBrowse, $EditorBrowse
    Local $tMsg, $tMenu, $tResources, $tVariables, $tStyles, $tAbout, $tExit

    If IsArray($varRead) Then
        For $i = 1 To UBound($varRead) - 1
            $FolderPath[StringRegExpReplace($varRead[$i][0], "(?i)Fpath", "")] = $varRead[$i][1]
        Next
    EndIf
    If IsArray($varRead) Then
        For $i = 1 To UBound($varRead) - 1
            $FiconPath[StringRegExpReplace($varRead[$i][0], "(?i)Ficon", "")] = $varRead[$i][1]
        Next
    EndIf

_GDIPlus_StartUp()
$guiImage   = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\coNfig.png")
$gui = GUICreate("", 400, 290, -1, -1, $WS_POPUP, $WS_EX_LAYERED)
SetTransparentBitmap($gui, $guiImage)

$gui_child = GUICreate("coNfig", 384, 246, 10, 37, $WS_POPUP, $WS_EX_MDICHILD, $gui)

    GUISetState(@SW_SHOW, $gui)
    GUISetState(@SW_SHOW, $gui_child)
;~  GUISwitch($gui_child)

 If _Vista_ICE() Then _Vista_EnableBlurBehind($gui_child)
 
    GUICtrlCreateGroup("Resources", 10, 145, 270, 55)
    GUICtrlSetFont(-1, 6, 400, 0, "hooge 05_53")
$gResources = GUICtrlCreateButton("Open..", 23, 163, 50)
    GUICtrlSetFont($gResources, 6, 400, 0, "hooge 05_53")
$gVariables = GUICtrlCreateButton("Var.inc", 82, 163, 50)
    GUICtrlSetFont($gVariables, 6, 400, 0, "hooge 05_53")
$gsave = GUICtrlCreateButton("Save", 295, 150, 55, 23)
$grefresh = GUICtrlCreateButton("Refresh", 295, 177, 55, 23)
    GUICtrlCreateTab(10, 10, 350, 130)

    ;<Folders
    $tab0 = GUICtrlCreateTabItem("Folders")

    GUICtrlCreateLabel("Folder:", 20, 50)
$ffList = GUICtrlCreateCombo("1", 60, 48, 35)
    GUICtrlSetData(-1, "2|3|4|5|6|7|8|9|10|11|12")
$ffPath = GUICtrlCreateInput("", 105, 48, 200)
$value = $FolderPath[GUICtrlRead($ffList)]
If $value = "" Then $value = "Path.   .   .   .   .   .   .   .   .   .   . [ browse>"
    GUICtrlSetData($ffPath, $value)
$ffBrowse = GUICtrlCreateButton("...", 315, 47, 30, 22)

    GUICtrlCreateLabel("Icon:", 28, 100)
$fiList = GUICtrlCreateCombo("1", 60, 98, 35)
    GUICtrlSetData(-1, "2|3|4|5|6|7|8|9|10|11|12")
$fiPath = GUICtrlCreateInput("", 105, 98, 200)
$value = $FiconPath[GUICtrlRead($fiList)]
    If $value = "" Then $value = "Icon.   .   .   .   .   .   .   .   .   .   . [ browse>"
    GUICtrlSetData($fiPath, $value)
$fiBrowse = GUICtrlCreateButton("...", 315, 97, 30, 22)
    ;Folders/>

    ;<Apps
    $tab1 = GUICtrlCreateTabItem("Apps")

    GUICtrlCreateLabel("App:", 20, 50)
$afList = GUICtrlCreateCombo("1", 60, 48, 35)
    GUICtrlSetData(-1, "2|3|4|5|6|7|8|9|10|11|12")
$afPath = GUICtrlCreateInput("", 105, 48, 200)
$value = $AppPath[GUICtrlRead($afList)]
If $value = "" Then $value = "Path.   .   .   .   .   .   .   .   .   .   . [ browse>"
    GUICtrlSetData($afPath, $value)
$afBrowse = GUICtrlCreateButton("...", 315, 47, 30, 22)

    GUICtrlCreateLabel("Icon:", 28, 100)
$aiList = GUICtrlCreateCombo("1", 60, 98, 35)
    GUICtrlSetData(-1, "2|3|4|5|6|7|8|9|10|11|12")
$aiPath = GUICtrlCreateInput("", 105, 98, 200)
$value = $AiconPath[GUICtrlRead($aiList)]
    If $value = "" Then $value = "Icon.   .   .   .   .   .   .   .   .   .   . [ browse>"
    GUICtrlSetData($aiPath, $value)
$aiBrowse = GUICtrlCreateButton("...", 315, 97, 30, 22)
    ;Apps/>

    ;<Drives
    $tab2 = GUICtrlCreateTabItem("Drives")
    ;Drives/>

    ;<System
    $tab3 = GUICtrlCreateTabItem("System")
    ;System/>

    ;<Editor
    $tab4 = GUICtrlCreateTabItem("Editor")
$ePath = GUICtrlCreateInput("", 25, 50, 270)
If $Editor = "" Then $Editor = "Default File Editor Path .  .  ."
    GUICtrlSetData($ePath, $Editor)
$eBrowse = GUICtrlCreateButton("...", 310, 49, 30, 24)
    GUICtrlCreateLabel("Browse or Enter the Editor's path manually." & @CRLF & "Choose the Default Editor with which the skin's resource files will open with - 'Var.inc', 'Styles.inc'", 35, 85, 290, 40, $SS_CENTER)
    ;Editor/>

    $tab_end = GUICtrlCreateTabItem("");

    GUICtrlSetState($tab0, $GUI_SHOW)

    ;<Tray
    $tMenu = TrayCreateMenu("Resources")
$tResources = TrayCreateItem("Open..", $tMenu)
    TrayCreateItem("", $tMenu)
$tVariables = TrayCreateItem("Variables", $tMenu)
$tStyles = TrayCreateItem("Styles", $tMenu)
    TrayCreateItem("")
$tAbout = TrayCreateItem("About")
    TrayCreateItem("")
$tExit = TrayCreateItem("Exit")
    ;Tray/>
    TraySetState(2)
    TraySetClick(24)
    GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
;~  GUIRegisterMsg($WM_PAINT, "MY_WM_PAINT")

GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN")

    While 1
        ;<Gui>
        $msg = GUIGetMsg()
        Switch $msg
            Case $GUI_EVENT_CLOSE
                If $prompt_yn > 0 Then Prompt()
                If $prompt_yn < 1 Then Exit
            Case $GUI_EVENT_MINIMIZE
                GUISetState(@SW_MINIMIZE)
                GUISetState(@SW_HIDE)
                TraySetState()
            Case $eBrowse
                $EditorBrowse = FileOpenDialog("Select Default Editor", @ScriptDir, "EXE (*.EXE)")
                If Not @error Then
                    GUICtrlSetData($ePath, $EditorBrowse)
                    $prompt_yn = 1
                EndIf
            Case $ffBrowse
                $ffRead = GUICtrlRead($ffList)
                $fPathBrowse = FileSelectFolder("Folder " & $ffRead & " path...", "")
                If Not @error Then
                    GUICtrlSetData($ffPath, $fPathBrowse)
                    $FolderPath[GUICtrlRead($ffList)] = $fPathBrowse
                    $prompt_yn = 1
                EndIf
            Case $fiBrowse
                $fiRead = GUICtrlRead($fiList)
                $fIconBrowse = FileOpenDialog("Icon " & $fiRead & " path...", @ScriptDir, "PNG (*.PNG)")
                If Not @error Then
                    GUICtrlSetData($fiPath, $fIconBrowse)
                    $FiconPath[GUICtrlRead($fiList)] = $fIconBrowse
                    $prompt_yn = 1
                EndIf
            Case $ffList
                $value = $FolderPath[GUICtrlRead($ffList)]
                If $value = "" Then $value = "Path.   .   .   .   .   .   .   .   .   .   . [ browse>"
                GUICtrlSetData($ffPath, $value)
            Case $fiList
                $value = $FiconPath[GUICtrlRead($fiList)]
                If $value = "" Then $value = "Icon.   .   .   .   .   .   .   .   .   .   . [ browse>"
                GUICtrlSetData($fiPath, $value)
            Case $gResources
                ShellExecute(@ScriptDir)
            Case $gVariables
                $Editor = IniRead($varFile, "Variables", "Editor", "C:\Windows\NotePad.exe")
                ShellExecute($Editor, @ScriptDir & '\Variables.inc', "")
            Case $gsave
                $prompt_yn = 0
                WriteINI()
            Case $grefresh
                ShellExecute("refresh.exe", $varRefresh)
        EndSwitch
        ;<Tray>
        $tMsg = TrayGetMsg()
        Switch $tMsg
            Case $tResources
                ShellExecute(@ScriptDir)
            Case $tVariables
                $Editor = IniRead($varFile, "Variables", "Editor", "C:\Windows\NotePad.exe")
                ShellExecute($Editor, @ScriptDir & '\Variables.inc', "")
            Case $tAbout
                About()
            Case $TRAY_EVENT_PRIMARYUP
                GUISetState(@SW_SHOWNORMAL)
                WinActivate($gui)
                TraySetState(2)
            Case $tExit
                Exit
        EndSwitch
    WEnd
EndFunc     ;==>coNfig

Func MY_WM_PAINT($hWnd, $Msg, $wParam, $lParam)
    _WinAPI_RedrawWindow($gui, 0, 0, $RDW_UPDATENOW)
    _GDIPlus_GraphicsDrawImage($hGraphic, $guiImage, 0, 0)
    _WinAPI_RedrawWindow($gui, 0, 0, $RDW_VALIDATE)
    Return $GUI_RUNDEFMSG
EndFunc

Func WriteINI()

    IniWrite($varFile, "Variables", "Editor", GUICtrlRead($ePath))

    For $i = 1 To 12
        IniWrite($varFile, "Variables", "Fpath" & $i, $FolderPath[$i])
    Next
    For $i = 1 To 12
        IniWrite($varFile, "Variables", "Ficon" & $i, $FiconPath[$i])
    Next
EndFunc     ;==>WriteINI

Func WM_COMMAND($hWnd, $msg, $wParam, $lParam)
    Local $chk = BitAND($wParam, 0x0000FFFF)

    Switch $chk
        Case $ffPath
            If FileExists(GUICtrlRead($ffPath)) Then
                $FolderPath[GUICtrlRead($ffList)] = GUICtrlRead($ffPath)
                GUICtrlSetBkColor($ffPath, 0xFFFFFFFF)
            Else
                GUICtrlSetBkColor($ffPath, 0xFF3333)
            EndIf
        Case $fiPath
            If FileExists(GUICtrlRead($fiPath)) Then
                $FiconPath[GUICtrlRead($fiList)] = GUICtrlRead($fiPath)
                GUICtrlSetBkColor($fiPath, 0xFFFFFFFF)
            Else
                GUICtrlSetBkColor($fiPath, 0xFF3333)
            EndIf
    EndSwitch
EndFunc     ;==>WM_COMMAND

Func Prompt()
    Local $promptbox

$promptbox = MsgBox(4, "Exit", "Without saving?")
    If $promptbox = 6 Then
        _GDIPlus_ShutDown()
        Exit
    EndIf
    If $promptbox = 7 Then Return
EndFunc     ;==>Prompt

Func About()
    Local $gLink, $gBTN, $bStartUp, $bStatus

    GUICreate("About", 210, 120, -1, -1)
$gLink = GUICtrlCreateLabel("CC BY-NC-SA" & @CRLF & "katoNkatoNK.deviantart.com", 20, 27, 170, 35, $SS_CENTER)
    GuiCtrlCreateGroup("About", 17, 10, 176, 55)
$bStartUp = GUICtrlCreateCheckbox("Add/Remove", 30, 84)
    GUICtrlCreateGroup("Run at Startup", 17, 70, 110, 40)
$gBTN = GUICtrlCreateButton("Close", 142, 80, 50, 26)

    GUISetState()

    While 1
        $msg = GUIGetMsg()
        $bStatus = GUICtrlRead($bStartUp)
        Switch $msg
            Case $gLink
                ShellExecute("http://katoNkatoNk.deviantart.com")
            Case $bStartUp
                If $bStatus = $GUI_CHECKED Then
                    RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "coNfig")
                    If Not @error Then
                        RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "coNfig", "REG_SZ", @ScriptDir & '\coNfig.exe')
                    EndIf
                EndIf
                If $bStatus = $GUI_UNCHECKED Then
                    RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "coNfig")
                    If Not @error Then
                        RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "coNfig")
                    EndIf
                EndIf
            Case $gBTN
                GUIDelete()
                ExitLoop
        EndSwitch
    WEnd
EndFunc     ;==>About

Func _WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam)
    _SendMessage($gui, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0)
EndFunc   ;==>_WM_LBUTTONDOWN

Func SetTransparentBitmap($hGUI, $hImage, $iOpacity = 0xFF)
    Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend
    $hScrDC = _WinAPI_GetDC(0)
    $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC)
    $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
    $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap)
    $tSize = DllStructCreate($tagSIZE)
    $pSize = DllStructGetPtr($tSize)
    DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage))
    DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage))
    $tSource = DllStructCreate($tagPOINT)
    $pSource = DllStructGetPtr($tSource)
    $tBlend = DllStructCreate($tagBLENDFUNCTION)
    $pBlend = DllStructGetPtr($tBlend)
    DllStructSetData($tBlend, "Alpha", $iOpacity)
    DllStructSetData($tBlend, "Format", 1)
    _WinAPI_UpdateLayeredWindow($hGUI,  $hMemDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)
    _WinAPI_ReleaseDC(0, $hScrDC)
    _WinAPI_SelectObject($hMemDC, $hOld)
    _WinAPI_DeleteObject($hBitmap)
    _WinAPI_DeleteDC($hMemDC)
EndFunc   ;==>SetTransparentBitmap

; #FUNCTION#;===============================================================================
;
; Name...........: _Vista_ApplyGlass
; Description ...: Applys glass effect to a window
; Syntax.........: _Vista_ApplyGlass($hWnd, [$bColor)
; Parameters ....: $hWnd - Window handle:
;                 $bColor  - Background color
; Return values .: Success - No return
;                 Failure - Returns 0
; Author ........: James Brooks
; Modified.......:
; Remarks .......: Thanks to weaponx!
; Related .......:
; Link ..........;
; Example .......; Yes
;
;;==========================================================================================
 Func _Vista_ApplyGlass($hWnd, $bColor = 0x000000)
     If @OSVersion <> "WIN_VISTA" Then
         MsgBox(16, "_Vista_ApplyGlass", "You are not running Vista!")
         Exit
     Else
         GUISetBkColor($bColor); Must be here!
         $Ret = DllCall("dwmapi.dll", "long", "DwmExtendFrameIntoClientArea", "hwnd", $hWnd, "long*", DllStructGetPtr($Struct))
         If @error Then
             Return 0
             SetError(1)
         Else
             Return $Ret
         EndIf
     EndIf
 EndFunc ;==>_Vista_ApplyGlass

; #FUNCTION#;===============================================================================
;
; Name...........: _Vista_ApplyGlassArea
; Description ...: Applys glass effect to a window area
; Syntax.........: _Vista_ApplyGlassArea($hWnd, $Area, [$bColor)
; Parameters ....: $hWnd - Window handle:
;                  $Area - Array containing area points
;                 $bColor  - Background color
; Return values .: Success - No return
;                 Failure - Returns 0
; Author ........: James Brooks
; Modified.......:
; Remarks .......: Thanks to monoceres!
; Related .......:
; Link ..........;
; Example .......; Yes
;
;;==========================================================================================
 Func _Vista_ApplyGlassArea($hWnd, $Area, $bColor = 0x000000)
     If @OSVersion <> "WIN_VISTA" Then
         MsgBox(16, "_Vista_ApplyGlass", "You are not running Vista!")
         Exit
     Else
         If IsArray($Area) Then
             DllStructSetData($Struct, "cxLeftWidth", $Area[0])
             DllStructSetData($Struct, "cxRightWidth", $Area[1])
             DllStructSetData($Struct, "cyTopHeight", $Area[2])
             DllStructSetData($Struct, "cyBottomHeight", $Area[3])
             GUISetBkColor($bColor); Must be here!
             $Ret = DllCall("dwmapi.dll", "long*", "DwmExtendFrameIntoClientArea", "hwnd", $hWnd, "ptr", DllStructGetPtr($Struct))
             If @error Then
                 Return 0
             Else
                 Return $Ret
             EndIf
         Else
             MsgBox(16, "_Vista_ApplyGlassArea", "Area specified is not an array!")
         EndIf
     EndIf
 EndFunc ;==>_Vista_ApplyGlassArea

; #FUNCTION#;===============================================================================
;
; Name...........: _Vista_EnableBlurBehind
; Description ...: Enables the blur effect on the provided window handle.
; Syntax.........: _Vista_EnableBlurBehind($hWnd)
; Parameters ....: $hWnd - Window handle:
; Return values .: Success - No return
;                 Failure - Returns 0
; Author ........: James Brooks
; Modified.......:
; Remarks .......: Thanks to komalo
; Related .......:
; Link ..........;
; Example .......; Yes
;
;;==========================================================================================
 Func _Vista_EnableBlurBehind($hWnd, $bColor = 0x000000)
     If @OSBuild < 6000 Then
         MsgBox(16, "_Vista_ApplyGlass", "You are not running Vista!")
         Exit
     Else
         Const $DWM_BB_ENABLE = 0x00000001

         DllStructSetData($sStruct, 1, $DWM_BB_ENABLE)
         DllStructSetData($sStruct, 2, "1")
         DllStructSetData($sStruct, 4, "1")

         GUISetBkColor($bColor); Must be here!
         $Ret = DllCall("dwmapi.dll", "int", "DwmEnableBlurBehindWindow", "hwnd", $hWnd, "ptr", DllStructGetPtr($sStruct))
         If @error Then
             Return 0
         Else
             Return $Ret
         EndIf
     EndIf
 EndFunc ;==>_Vista_EnableBlurBehind

; #FUNCTION#;===============================================================================
;
; Name...........: _Vista_ICE
; Description ...: Returns 1 if DWM is enabled or 0 if not
; Syntax.........: _Vista_ICE()
; Parameters ....:
; Return values .: Success - Returns 1
;                 Failure - Returns 0
; Author ........: James Brooks
; Modified.......:
; Remarks .......: Thanks to BrettF
; Related .......:
; Link ..........;
; Example .......; Yes
;
;;==========================================================================================
 Func _Vista_ICE()
     $ICEStruct = DllStructCreate("int;")
     $Ret = DllCall("dwmapi.dll", "int", "DwmIsCompositionEnabled", "ptr", DllStructGetPtr($ICEStruct))
     If @error Then
         Return 0
     Else
         Return DllStructGetData($ICEStruct, 1)
     EndIf
 EndFunc ;==>_Vista_ICE

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Thanks so much UEZ!

it's working great :unsure:

There is one more thing that could make it easier to apply to the gui,

if it is possible to keep the main gui its default colour and stop it from turning black when on top of the aero frame?

otherwise the rest of the controls look a bit out of place with black/transparent borders around them

and can't be seen if its on a while background

Thanks again

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  
Followers 0