rafleo Posted March 7, 2010 Share Posted March 7, 2010 Hello there,I am working on my first script, and having some GUI troubles...The GUI displays alright with fade in and fade out, but I never get to see my Progressbar.Why isn't it showing? What am I missing?expandcollapse popup#include <GDIPlus.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> #include <GUIFade.au3> Opt("MustDeclareVars", 1) Global Const $AC_SRC_ALPHA = 1 Global $hGUI1, $hImage, $progressbar Global $max_trans = 200 ; Create layered window $hGUI1 = GUICreate("Volume", 240, 220, -1, -1, -1, $WS_EX_LAYERED) $progressbar = GUICtrlCreateProgress ( 10, 160, 220, 30) GUICtrlSetData (-1, 75) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, 0x3399FF) ; Load layered image _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\img\osd_volume.png") SetBitMap($hGUI1, $hImage, 0) GUISetState() Global $i = 0 Do $i = $i + 5 If $i > 255 Then $i = 255 SetBitMap($hGUI1, $hImage, $i) Sleep(1) Until $i >= 255 ; Register notification messages GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") ; Loop until user exits do until GUIGetMsg() =$GUI_EVENT_CLOSE Global $i = 255 Do $i = $i - 5 SetBitMap($hGUI1, $hImage, $i) Until $i = 0 ; Release resources _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() ; 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) EndFuncAlso, while you're at it, I didn't find a way to make the GUI always on top with no taskbar button.Thank you for your help! Link to comment Share on other sites More sharing options...
Beege Posted March 8, 2010 Share Posted March 8, 2010 Try setting the layered window attribute. $hGUI1 = GUICreate("Volume", 240, 220, -1, -1, -1, $WS_EX_LAYERED) $progressbar = GUICtrlCreateProgress ( 10, 160, 220, 30) GUICtrlSetData (-1, 75) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, 0x3399FF) _WinAPI_SetLayeredWindowAttributes($hGUI1, 0x010101) Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator Link to comment Share on other sites More sharing options...
Yashied Posted March 8, 2010 Share Posted March 8, 2010 (edited) Typically, controls does not works with a window that has WS_EX_LAYERED style. Prepare a few images for the state of progress and draw them on the main image ($hImage) by using a _GDIPlus_GraphicsDrawImageRect() function. Then apply your SetBitMap() function.If you are using WS_EX_LAYERED to fade in/out only, it is better to use WinSetTrans(). Edited March 8, 2010 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...
rafleo Posted March 8, 2010 Author Share Posted March 8, 2010 Thanks, I'll try that. 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