James Posted July 8, 2008 Author Share Posted July 8, 2008 That is because @OS_TYPE returns the windows family the user is running, not the current version of windows.Try @OS_Version instead muttleySomeone punch me! Thanks!I have recreated this in VB6 and I know why the control does not appear correctly after "glassification". In the VB6 version, I can create the tRect which covers and inside area which does not get the glass effect. Anything inside that area is left alone, thus keeping the controls how they should be. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
James Posted July 8, 2008 Author Share Posted July 8, 2008 Finally! I am on to something here. I have managed to get an array to equal a rectangle which should not be effected, however it only seems to work for the left side... Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
monoceres Posted July 8, 2008 Share Posted July 8, 2008 Finally! I am on to something here. I have managed to get an array to equal a rectangle which should not be effected, however it only seems to work for the left side...You should check out the msdn page, it tells you just about everything.http://msdn.microsoft.com/en-us/library/aa969512(VS.85).aspx Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
James Posted July 8, 2008 Author Share Posted July 8, 2008 (edited) You should check out the msdn page, it tells you just about everything.http://msdn.microsoft.com/en-us/library/aa969512(VS.85).aspxI have done, but another read won't harm me, it might be really useful!Edit: Nope, because I don't know how to create a MARGINS structure. Edited July 8, 2008 by JamesBrooks Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
monoceres Posted July 8, 2008 Share Posted July 8, 2008 I have done, but another read won't harm me, it might be really useful! Edit: Nope, because I don't know how to create a MARGINS structure. This is how: $struct=DllStructCreate("int cxLeftWidth;int cxRightWidth;int cyTopHeight;int cyBottomHeight;") Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
James Posted July 8, 2008 Author Share Posted July 8, 2008 (edited) Ok, so I can just change the values to the $Area array? Edit: Just some code: $Area[4] = [50, 50, 50, 50] 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 GUISetBkColor($bColor); Must be here! Return DllCall("dwmapi.dll", "long*", "DwmExtendFrameIntoClientArea", "hwnd", $hWnd, "long*", $Area[0]) Else MsgBox(16, "_Vista_ApplyGlassArea", "Area specified is not an array!") EndIf EndIf EndFunc ;==>_Vista_ApplyGlassArea If you test it, you will only get the left hand side with the glass effect. How do I use the code from above to create the margins? Edited July 8, 2008 by JamesBrooks Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
monoceres Posted July 8, 2008 Share Posted July 8, 2008 (edited) 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 muttley Edited July 8, 2008 by monoceres Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
James Posted July 8, 2008 Author Share Posted July 8, 2008 (edited) Ahh! Thanks Mono! I shall have lots of fun today muttley It works. By the way, you made a little error in the code: DllStructSetData($struct,"cxTopHeight",0) Should be: DllStructSetData($struct,"cyTopHeight",0) I am starting to understand Structures now, I think! Edited July 8, 2008 by JamesBrooks Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
LIMITER Posted July 8, 2008 Share Posted July 8, 2008 (edited) Just use this and you'll have a full red glass window #include <StructureConstants.au3> #include <GUIConstants.au3> $GUI = GUICreate("Windows Vista DWM", 243, 243) $Apply = GUICtrlCreateButton("Apply", 80, 104, 83, 25, 0) GUISetState(@SW_SHOW) While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE Exit Case $Apply $Ret = ApplyGlass($GUI,243,243,243,243,0xFF0000); produces full glass window, the glass is red colored EndSwitch WEnd Func ApplyGlass($hWnd,$leftw,$rightw,$toph,$bottomh,$glasscolor = "0x000000") $struct=DllStructCreate("int cxLeftWidth;int cxRightWidth;int cyTopHeight;int cyBottomHeight;") DllStructSetData($struct,"cxLeftWidth",$leftw) DllStructSetData($struct,"cxRightWidth",$rightw) DllStructSetData($struct,"cyTopHeight",$toph) DllStructSetData($struct,"cyBottomHeight",$bottomh) GUISetBkColor($glasscolor) Return DllCall("dwmapi.dll", "int", "DwmExtendFrameIntoClientArea", "hwnd", $hWnd, "ptr", DllStructGetPtr($struct)) EndFunc Edited July 8, 2008 by LIMITER Link to comment Share on other sites More sharing options...
James Posted July 8, 2008 Author Share Posted July 8, 2008 Limiter, does that fix the problem of some of the frame area not being covered? Check first post, for both functions! Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Touch Posted July 8, 2008 Share Posted July 8, 2008 Wow this is amazing! My Dad thinks this is great! Did you people know you can use a different windows handle like Notepad? ACE! [center][font="Arial"]If practise makes perfect and no-ones perfect whats the point of practise?[/font]Sorry for my rude attitude when I started here.[/center] Link to comment Share on other sites More sharing options...
LIMITER Posted July 8, 2008 Share Posted July 8, 2008 (edited) Check the edited post (Post #30)It resolves all the errors muttleyP.S.This is the output: Edited July 8, 2008 by LIMITER Link to comment Share on other sites More sharing options...
monoceres Posted July 8, 2008 Share Posted July 8, 2008 Just one more thing, $tagMargins is the exact same thing as the struct I created so you can replace my DllStructCreate("int cxLeftWidth;int cxRightWidth;int cyTopHeight;int cyBottomHeight;") with DllStructCreate($tagMargins) muttley Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
James Posted July 8, 2008 Author Share Posted July 8, 2008 Nice work Limiter, I will update the function in a minute, I might automatically get the window size to save time muttley Monoceres, that means no need for StructureConstants.au3? Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
monoceres Posted July 8, 2008 Share Posted July 8, 2008 Monoceres, that means no need for StructureConstants.au3?If you like, I'm just saying that you don't need to use both DllStructCreate("int cxLeftWidth;int cxRightWidth;int cyTopHeight;int yBottomHeight;") and DllStructCreate($tagMargin) Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
monoceres Posted July 8, 2008 Share Posted July 8, 2008 Wow this is amazing! My Dad thinks this is great! Did you people know you can use a different windows handle like Notepad? ACE!WinGetHandle() Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
James Posted July 8, 2008 Author Share Posted July 8, 2008 (edited) Note: If you want only a little bit of the GUI such as the bottom to be effected then here is an example showing you how:#include <GUIConstants.au3> #include <Vista.au3> Global $Area[4] = [0, 0, 0, 76] $GUI = GUICreate("GUI", 408, 181) GUICtrlCreateLabel("I shall not be affected by the Glass!", 112, 64, 170, 17) GUICtrlCreateLabel("", 0, 105, 408, 76) GUICtrlSetBkColor(-1, 0x000000) _Vista_ApplyGlassArea($GUI, $Area, 0xE2E2E2) GUISetState(@SW_SHOW) While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEndHave fun!Edit: Here is a screenshot!I have fixed the little white line seen in the screenshot! Edited July 8, 2008 by JamesBrooks Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
malu05 Posted July 8, 2008 Share Posted July 8, 2008 Ohh Cool. What if you run this on XP? will it just be normal? [center][u]WoW Machinima Tool[/u] (Tool for Machinima Artists) [/center] Link to comment Share on other sites More sharing options...
James Posted July 8, 2008 Author Share Posted July 8, 2008 Ohh Cool.What if you run this on XP? will it just be normal?It will error and close. DWM is a Vista thing only. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Touch Posted July 8, 2008 Share Posted July 8, 2008 WinGetHandle()Yeah! I know, I was just saying muttley Note: If you want only a little bit of the GUI such as the bottom to be effected then here is an example showing you how: #include <GUIConstants.au3> #include <Vista.au3> Global $Area[4] = [0, 0, 0, 77] $GUI = GUICreate("GUI", 408, 181) GUICtrlCreateLabel("I shall not be affected by the Glass!", 112, 64, 170, 17) GUICtrlCreateLabel("", 0, 104, 408, 76) GUICtrlSetBkColor(-1, 0x000000) _Vista_ApplyGlassArea($GUI, $Area, 0xE2E2E2) GUISetState(@SW_SHOW) While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd If you created the label at the bottom of the GUI then you need to edit the last $Area co-ordinate and + 1 to it so it will cover it properly. Have fun!Neat example James. I see you have also updated System Properties Wrapper with the GUI nice! 5 stars for both scripts! [center][font="Arial"]If practise makes perfect and no-ones perfect whats the point of practise?[/font]Sorry for my rude attitude when I started here.[/center] 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