FireFox Posted September 5, 2009 Share Posted September 5, 2009 (edited) Hi, I have created an Alpha's Blend window with the advanced example of AutoIt. It works fine for the picture, but any control is visible expandcollapse popup#include <GDIPlus.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> Global Const $AC_SRC_ALPHA = 1 Global $hGUI1, $hGUI2, $iLabel1, $iLabel2, $iSlider, $hImage ; Create GUI $hGUI1 = GUICreate("", 400, 100) $iLabel1 = GUICtrlCreateLabel ("Adjust slider to change opacity level: (0-255)", 84, 10, 380, 20) $iSlider = GUICtrlCreateSlider(10, 32, 380, 40) $iLabel2 = GUICtrlCreateLabel ("Drag the layered window around your desktop" , 80, 74, 380, 20) GUICtrlSetLimit($iSlider, 255, 0) GUICtrlSetData ($iSlider, 255) GUISetState(@SW_SHOW, $hGUI1) ; Create layered child window $hGUI2 = GUICreate("", 332, 180, -1, -1, -1, $WS_EX_LAYERED, $hGUI1) ; Load layered image _GDIPlus_Startup( ) $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\WLM.png") SetBitMap($hGUI2, $hImage, 255) GUICtrlCreateEdit('test', 0, 0, 332, 180) GUICtrlSetFont(-1, 32) GUISetState(@SW_SHOW, $hGUI2) ; Register notification messages GUIRegisterMsg($WM_HSCROLL , "WM_HSCROLL" ) GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") ; Loop until user exits Do Sleep(50) Until GUIGetMsg( ) = $GUI_EVENT_CLOSE ; Release resources _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown( ) ; =============================================================================================================================== ; Handle the WM_HSCROLL notificaton so that we can change the opacity in real time ; =============================================================================================================================== Func WM_HSCROLL($hWnd, $iMsg, $iwParam, $ilParam) SetBitMap($hGUI2, $hImage, GUICtrlRead($iSlider)) EndFunc ; =============================================================================================================================== ; Handle the WM_NCHITTEST for the layered window so it can be dragged by clicking anywhere on the image. ; =============================================================================================================================== Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam) If ($hWnd = $hGUI2) And ($iMsg = $WM_NCHITTEST) Then Return $HTCAPTION EndFunc ; =============================================================================================================================== ; SetBitMap ; =============================================================================================================================== Func SetBitmap($hGUI, $hImage, $iOpacity) 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", $AC_SRC_ALPHA) _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) _WinAPI_ReleaseDC (0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC ($hMemDC) EndFunc Don't forget to download the attached picture Thanks for anyhelp ! Cheers, FireFox. Edited September 5, 2009 by FireFox Link to comment Share on other sites More sharing options...
Yashied Posted September 5, 2009 Share Posted September 5, 2009 (edited) http://www.autoitscript.com/forum/index.php?showtopic=95043 + WinSetTrans() Edited September 5, 2009 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now