Here modern coding (removed useless code) :
#include <WinAPISysWin.au3>
#include <WinAPIConstants.au3>
#include <GDIPlus.au3>
#include <GuiComboBox.au3>
#include <File.au3>
#include <WindowsConstants.au3>
#include <GuiConstants.au3>
#include <ButtonConstants.au3>
Opt("MustDeclareVars", True)
Global Const $AC_SRC_ALPHA = 1
Example()
Func Example()
; Load PNG file as GDI bitmap
_GDIPlus_Startup()
Local $sPngSrc = @ScriptDir & "\LaunchySkin.png"
Local $hImage = _GDIPlus_ImageLoadFromFile($sPngSrc)
; Extract image width and height from PNG
Local $iWidth = _GDIPlus_ImageGetWidth($hImage)
Local $iHeight = _GDIPlus_ImageGetHeight($hImage)
; Create layered window
Local $hGUI = GUICreate("", $iWidth, $iHeight, -1, -1, $WS_POPUP, $WS_EX_LAYERED)
Local $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
_WinAPI_UpdateLayeredWindowEx($hGUI, -1, -1, $hBitmap)
; Register notification messages
GUIRegisterMsg($WM_NCHITTEST, WM_NCHITTEST)
GUISetState()
WinSetOnTop($hGUI, "", $WINDOWS_ONTOP)
; As per help file :
; When using $WS_EX_MDICHILD the position is relative to client area of the parent window.
; With $WS_EX_LAYERED it is possible to have a transparent picture on a background picture defined in the parent window.
; To have a transparent picture, create the GUI with the WS_EX_LAYERED extended style.
; The left-top pixel will be used as the transparency color.
; If several pictures are created the last picture defines the transparent color.
GUICreate("", $iWidth, $iHeight, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $hGUI)
GUICtrlCreatePic(@ScriptDir & "\grey.gif", 0, 0, $iWidth, $iHeight) ; makes the whole child GUI transparent
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateLabel("Type the name of a file on" & @CR & "your desktop and press Enter", 50, 30, 140, 60)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)
; combo box listing all items on desktop
Local $idCombo = GUICtrlCreateCombo("", 210, 30, 250, -1, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL))
GUICtrlSetFont($idCombo, 10)
; set default button for Enter key activation - renders outside GUI window
Local $idButton = GUICtrlCreateButton("", 0, 0, 0, 0, $BS_DEFPUSHBUTTON)
GUISetState()
; get list of files on desktop, show in combobox
Local $aFileList = _FileListToArray(@DesktopDir), $sRun
_ArraySort($aFileList, 0, 1)
GUICtrlSetData($idCombo, _ArrayToString($aFileList, "|", 1))
While True
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $idButton
$sRun = GUICtrlRead($idCombo)
ExitLoop
EndSwitch
WEnd
If $sRun And FileExists(@DesktopDir & "\" & $sRun) Then
Beep(2000, 50)
ShellExecute($sRun, "", @DesktopDir)
EndIf
_WinAPI_DeleteObject($hBitmap)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_Shutdown()
EndFunc ;==>Example
Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam)
Return $HTCAPTION
EndFunc ;==>WM_NCHITTEST