James Posted July 10, 2008 Author Share Posted July 10, 2008 (edited) While you both are correct, it saddens me a little that you are both so unsure. It's not hard to figure these types out. They're documented.Holy shizzle, I was right! Nah, I did try and work it out. Thinking in binary (don't ask) 0 = off 1 = on, I then worked it out somewhat using ASM muttley Yeah, I guess I was lazy. Here's an example on using the function on the msdn page above btw: $hwnd=GUICreate("Sample",300,200) GUISetState() GUISetBkColor(0x000000) Global Const $DWM_BB_ENABLE=0x01 Global Const $DWM_BB_BLURREGION=0x02 Global Const $DWM_BB_TRANSITIONONMAXIMIZED=0x04 $DWM_BLURBEHIND=DllStructCreate("dword dwFlags;int fEnable;int hRgnBlur;int fTransitionOnMaximized;") DllStructSetData($DWM_BLURBEHIND,"dwFlags",BitOR($DWM_BB_ENABLE,$DWM_BB_BLURREGION)) DllStructSetData($DWM_BLURBEHIND,"fEnable",1) DllStructSetData($DWM_BLURBEHIND,"hRgnBlur",0) DllStructSetData($DWM_BLURBEHIND,"fTransitionOnMaximized",1) DllCall("dwmapi.dll","int","DwmEnableBlurBehindWindow","hwnd",$hwnd,"ptr",DllStructGetPtr($DWM_BLURBEHIND)) Do $msg=GUIGetMsg() Until $msg=-3No way, I did the same thing just as you posted it! Weird! - Mine didn't work though. The button is still weird. Grr. Here is what I did for the function: Global Const $DWM_BB_ENABLE = 0x01 Global Const $DWM_BB_BLURREGION = 0x02 Global Const $DWM_BB_TRANSITIONONMAXIMIZED = 0x04 Global $_DWM_BLURBEHIND = DllStructCreate("dword dwFlags;int fEnable;int hRgnBlur;int fTransitionOnMaximized;") Func _Vista_ApplyGlassBehind($hWnd) If @OSVersion <> "WIN_VISTA" Then MsgBox(16, "_Vista_ApplyGlass", "You are not running Vista!") Exit Else DllStructSetData($_DWM_BLURBEHIND, "dwFlags", BitOR($DWM_BB_ENABLE, $DWM_BB_BLURREGION)) DllStructSetData($_DWM_BLURBEHIND, "fEnable", 1) DllStructSetData($_DWM_BLURBEHIND, "hRgnBlur", 0) DllStructSetData($_DWM_BLURBEHIND, "fTransitionOnMaximized", 1) DllCall("dwmapi.dll", "int", "DwmEnableBlurBehindWindow", "hwnd", $hwnd, "ptr", DllStructGetPtr($_DWM_BLURBEHIND)) EndIf EndFunc ;==>_Vista_ApplyGlassBehind Edited July 10, 2008 by JamesBrooks Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
ProgAndy Posted July 10, 2008 Share Posted July 10, 2008 (edited) Shouldn't hrgnBlur be a PTR / long ? THen, create the Blur-Rgn with:http://www.autoitscript.com/forum/index.ph...ost&p=19306Possibly this works, can't test because -> No Vista muttleyCODE$hwnd=GUICreate("Sample",300,200)GUISetState()$butt = GUICtrlCreateButton("test",10,10,100,30)GUISetBkColor(0x000000)Global Const $DWM_BB_ENABLE=0x01Global Const $DWM_BB_BLURREGION=0x02Global Const $DWM_BB_TRANSITIONONMAXIMIZED=0x04Dim $Ctrls[1] = [$butt]_CreateBlurBehind($hwnd,$ctrls)Do $msg=GUIGetMsg()Until $msg=-3 ; Parameters: $hwnd - Handle of GUI-Window; $NotBlurControls - 1-Dim Array of CtrlIDs which should ; not be included in Blur-Rgn; Author(s): Prog@ndy, made it from code out of the Thread Func _CreateBlurBehind($hwnd,ByRef $NotBlurControls) Local $DWM_BLURBEHIND=DllStructCreate("dword dwFlags;int fEnable;ptr hRgnBlur;int fTransitionOnMaximized;") DllStructSetData($DWM_BLURBEHIND,"dwFlags",BitOR($DWM_BB_ENABLE,$DWM_BB_BLURREGION)) DllStructSetData($DWM_BLURBEHIND,"fEnable",1) Local $pos = WinGetClientSize($hwnd) Local $CompleteRgn = CreateRectRegion(0,0,$pos[0],$pos[1]) For $i = 0 To UBound($NotBlurControls)-1 $rgn = _CreateRectRgnFromControl($NotBlurControls[$i] RemoveFromRgn($CompleteRgn,$rgn) DeleteRgn($rgn) Next DllStructSetData($DWM_BLURBEHIND,"hRgnBlur",$CompleteRgn) DllStructSetData($DWM_BLURBEHIND,"fTransitionOnMaximized",1) DllCall("dwmapi.dll","int","DwmEnableBlurBehindWindow","hwnd",$hwnd,"ptr",DllStructGetPtr($DWM_BLURBEHIND))EndFunc; Author(s): Prog@ndyFunc RemoveFromRgn(ByRef $rgn1, ByRef $rgn2) DllCall("gdi32.dll", "long", "CombineRgn", "long", $rgn1, "long", $rgn1, "long", $rgn2, "int", 4)EndFunc; Author(s): Prog@ndyFunc RemoveMultiFromRgn(ByRef $rgn1, ByRef $rgnarray) For $i = 0 To UBound($a_rgns)-1 DllCall("gdi32.dll", "long", "CombineRgn", "long", $rgn1, "long", $rgn1, "long", $rgnarray[$i], "int", 4) NextEndFunc; Author(s): Prog@ndyFunc _CreateRectRgnFromControl($CtrlID) Local $pos = ControlGetPos(GUICtrlGetHandle($CtrlID),"","") Return CreateRectRgn($pos[0],$pos[1],$pos[2],$pos[3])EndFuncFunc DeleteRgn(ByRef $rgn) DllCall("gdi32.dll","int","DeleteObject","ptr",$rgn)EndFunc;===============================================================================;; Function Name: CreateRectRegion(); Description:: Creates a Rectangular Region; Parameter(s): left, top, width, height; Requirement(s): AutoIt Beta; Return Value(s): Region Handle; Author(s): RazerM;;===============================================================================;Func CreateRectRgn($l, $t, $w, $h) $ret = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $l, "long", $t, "long", $l + $w, "long", $t + $h) Return $ret[0]EndFunc//Edit: @JamesBrooks: You didn't remove the button from the Rgn which should be blurred Edited July 10, 2008 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
monoceres Posted July 10, 2008 Share Posted July 10, 2008 Shouldn't hrgnBlur be a PTR / long ?Probably.Just plugged in an int there because Visual Studio 2008 told me HRGN was 4 bytes in size. Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
James Posted July 10, 2008 Author Share Posted July 10, 2008 (edited) I don't have the correct function Andy. The idea is to be able to keep the controls. When I added one to monoceres version it worked just fine. Changing int to ptr or long changes nothing that I can see. Edited July 10, 2008 by JamesBrooks Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
ProgAndy Posted July 10, 2008 Share Posted July 10, 2008 OK, Then i can't help anymore. As i sad, I have no Vista muttley *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
Valik Posted July 10, 2008 Share Posted July 10, 2008 Some of you are in way over your head and I really question how much you're actually learning because some of the leaps in logic and the lack of proper research is simply astounding. Link to comment Share on other sites More sharing options...
James Posted July 10, 2008 Author Share Posted July 10, 2008 Some of you are in way over your head and I really question how much you're actually learning because some of the leaps in logic and the lack of proper research is simply astounding.I have learnt a little bit about structures! Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
GaryFrost Posted July 10, 2008 Share Posted July 10, 2008 After I have finished all the glass effects, my next job is the Task Dialogs!I suggest staying away from the Task Dialogs for a while, at least till you know structures, callbacks and more. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
James Posted July 10, 2008 Author Share Posted July 10, 2008 I suggest staying away from the Task Dialogs for a while, at least till you know structures, callbacks and more.Probably the best idea I have heard in years! Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Ibrahim Posted July 22, 2008 Share Posted July 22, 2008 anyone Got any for windows XP [font="Arial Black"]My Stuff[/font]UPnP Port Forwarding Final.GateWay InformationThe GateWay Watcher(detect speeofing)Rightclick Any file --->Hide/UnhideThe Tip WatcherA PanelShare WatcherThe Arp WatcherThe Online License Checker Link to comment Share on other sites More sharing options...
James Posted July 22, 2008 Author Share Posted July 22, 2008 This does not work on Windows XP because it requires DWM. The only possible way to make something like this work on XP is to get some of the GDI masters to make something that works similarily to how MS does it. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
EvAsion Posted July 22, 2008 Share Posted July 22, 2008 I tried this a few months ago, but had the same problem as you with only the left side of the region working.. Thanks for finally figuring this out.http://www.autoitscript.com/forum/index.php?showtopic=72918Maybe you could try and create a full dwm library. I'm quite interested in being able to use the thumbnail preview windows that you see when alt-tabbing for example.. see: DwmUpdateThumbnailProperties Function. |-- Periodic Table --||-- Dynamic Class Timetable --||-- Navigation in Counter-Strike --| Link to comment Share on other sites More sharing options...
James Posted July 22, 2008 Author Share Posted July 22, 2008 Thanks for the positive EvAsion muttley I will defintley look into it. I had a quick peek when I was looking at this. Thanks again! Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
MilesAhead Posted May 14, 2009 Share Posted May 14, 2009 No, no, no, you've got this all mixed up. Here's how you should do it: $hwnd=GUICreate("sample",300,300) GUISetState() $struct=DllStructCreate("int cxLeftWidth;int cxRightWidth;int cyTopHeight;int cyBottomHeight;") DllStructSetData($struct,"cxLeftWidth",130) DllStructSetData($struct,"cxRightWidth",3) DllStructSetData($struct,"cyTopHeight",0) DllStructSetData($struct,"cyBottomHeight",25) GUISetBkColor(0x000000) DllCall("dwmapi.dll", "int", "DwmExtendFrameIntoClientArea", "hwnd", $hWnd, "ptr", DllStructGetPtr($struct)) Do $msg=GUIGetMsg() Until $msg=-3 Now play with the values in the struct until you understand what they mean I'm wondering if you have to tell Vista something about the transparent color if it's not black? As you can see from the screen shots, if the background of the form is black, I get the thick glass border. If it's red, the area between the normal size border and the extend region is sort of see though pink. My Freeware Page Link to comment Share on other sites More sharing options...
MilesAhead Posted May 15, 2009 Share Posted May 15, 2009 I'm wondering if you have to tell Vista something about the transparent color if it's not black? As you can see from the screen shots, if the background of the form is black, I get the thick glass border. If it's red, the area between the normal size border and the extend region is sort of see though pink. In _Vista_ApplyGlassArea() I think it could be made to work as expected if the extended region was painted black instead of just setting the background color for the window. But I haven't figured out how to do much with Paint in AutoIt3 yet. Func _Vista_ApplyGlassArea($hWnd, $Area, $bColor = 0x000000) If Not _GlassEnabled() Then Return 0 If IsArray($Area) Then DllStructSetData($Struct, "cxLeftWidth", $Area[0]) DllStructSetData($Struct, "cxRightWidth", $Area[1]) DllStructSetData($Struct, "cyTopHeight", $Area[2]) DllStructSetData($Struct, "cyBottomHeight", $Area[3]) ;only the region of the Glass extension should be painted black. ;somehow the form should be made to only repaint inside the boundary? 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 EndFunc ;==>_Vista_ApplyGlassArea My Freeware Page Link to comment Share on other sites More sharing options...
MilesAhead Posted May 16, 2009 Share Posted May 16, 2009 (edited) It's a hack using black labels to mask the border if background color <> black, but it works. Edit: (I fixed the bug in $L1 label creation line. Should work via cut & paste now.) Func _Vista_ApplyGlassArea($hWnd, $Area, $bColor = 0x000000) If Not _GlassEnabled() Then Return 0 If IsArray($Area) Then If $bColor <> 0x000000 Then Local $clientH = _WinAPI_GetClientHeight($hWnd) Local $clientW = _WinAPI_GetClientWidth($hWnd) EndIf 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! If $bColor <> 0x000000 Then Local $L1 = GUICtrlCreateLabel("", 0, 0, $clientW, $Area[2]) GUICtrlSetBkColor(-1, 0x000000) Local $L2 = GUICtrlCreateLabel("", 0, 0, $Area[0], $clientH) GUICtrlSetBkColor(-1, 0x000000) Local $L3 = GUICtrlCreateLabel("", $clientW - $Area[1], 0, $Area[1], $clientH) GUICtrlSetBkColor(-1, 0x000000) Local $L4 = GUICtrlCreateLabel("", 0, $clientH - $Area[3], $clientW, $Area[3]) GUICtrlSetBkColor(-1, 0x000000) EndIf $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 EndFunc ;==>_Vista_ApplyGlassArea and the _GlassEnabled() is Global Enum $WIN_95, $WIN_98, $WIN_ME, $WIN_NT, $WIN_2000, $WIN_XP, $WIN_2003, _ $WIN_VISTA, $WIN_2008 Func _OsLevel() Local $ver = @OSVersion Local $winVersions[9] = ["WIN_95", "WIN_98", "WIN_ME", "WIN_NT4", "WIN_2000", _ "WIN_XP", "WIN_2003", "WIN_VISTA", "WIN_2008"] For $i = $WIN_95 To UBound($winVersions) - 1 If $winVersions[$i] = $ver Then Return $i Next EndFunc ;==>_OsLevel Func _GlassEnabled() If _OsLevel() < $WIN_VISTA Then Return 0 $retValue = Dllcall("dwmapi.dll","int","DwmIsCompositionEnabled","int*","") If @error Then Return 0 return $retValue[1] EndFunc I do OsLevel() returning an enumerated type to make comparison easier. Windows8 may not return "WIN_VISTA" but it should be >= $WIN_VISTA etc.. Edited May 26, 2009 by MilesAhead My Freeware Page Link to comment Share on other sites More sharing options...
ken82m Posted May 16, 2009 Share Posted May 16, 2009 Cool, I'm gonna try it on one of my new scripts tomorrow. Thanks man -Kenny "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains." Link to comment Share on other sites More sharing options...
MilesAhead Posted May 16, 2009 Share Posted May 16, 2009 Cool, I'm gonna try it on one of my new scripts tomorrow. Thanks man -Kenny Found a bug. When the first Label is created it should use $Area[2] not subscript 0, like this: Local $L1 = GUICtrlCreateLabel("", 0, 0, $clientW, $Area[2]) Sorry about that. I caught it just now. I wish when they do these rectangles they would keep the dimensions in the same order. That's why I didn't use _WinAPI_GetClientRect(). Confuses the hell out of me when the order keeps getting shuffled. My Freeware Page Link to comment Share on other sites More sharing options...
ken82m Posted May 20, 2009 Share Posted May 20, 2009 hmm mine doesn't seem to come out quite right. Any ideas?I'm running W7 so maybe that's throwing it off. I don't have a Vista machine to test it on.Thanks,Kenny "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains." Link to comment Share on other sites More sharing options...
James Posted May 25, 2009 Author Share Posted May 25, 2009 (edited) MilesAhead, it's a sweet little hack. Also, Ken, it works fine for me on 7. Edited May 25, 2009 by JamesBrooks Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ 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