James Posted July 7, 2008 Posted July 7, 2008 (edited) Hi guys, I found a little script to make the aero theme available on VB6 applications and am trying to bring it to AutoIt. I have the following function which returns the values needed to set the area up(the easy bit): Func ApplyGlass($hWnd, $tRect, $dll = "dwmapi.dll") Return DllCall($dll, "long", "DwmExtendFrameIntoClientArea", $hWnd, "long", $tRect, "long"); Last long relates to tRect EndFunc However I do not know how to convert: Private Type tRect m_Left As Long m_Right As Long m_Top As Long m_Buttom As Long End Type In to AutoIt so I can get: Private Sub cmdGlass_Click() Dim GRect As tRect Dim lngReturn As Long GRect.m_Buttom = 50 GRect.m_Left = 50 GRect.m_Right = 50 GRect.m_Top = 50 Me.BackColor = vbBlack lngReturn = ApplyGlass(Me.hWnd, GRect) lblReturn.Caption = "Return: " & lngReturn End Sub How do I get the "tRect" to work in AutoIt? I have tried using an array but it didn't work. Sorry it's a bit iffy, but this is something which would really jazz up AutoIt! James Edit: Spelling. Edited July 7, 2008 by JamesBrooks Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
Siao Posted July 7, 2008 Posted July 7, 2008 As if it's something new to AutoIt... Scite, Search > Find in files..., point to AutoIt include folder, and search for tRect. Or actually, search for the same in helpfile. "be smart, drink your wine"
James Posted July 7, 2008 Author Posted July 7, 2008 Ok, I have tried using $tagRECT and changing the int to long like the VB6 example but nadda. How do I get what I am after? I see no way of creating my own point structures. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
weaponx Posted July 7, 2008 Posted July 7, 2008 (edited) The MSDN documentation for DwmExtendFrameIntoClientArea shows it only accepts two values:HRESULT DwmExtendFrameIntoClientArea( HWND hWnd, const MARGINS *pMarInset);The second value is not a tRect but a MARGINS struct:typedef struct _MARGINS { int cxLeftWidth; int cxRightWidth; int cyTopHeight; int cyBottomHeight;} MARGINS, *PMARGINS;Also in your DllCall you need to pass the structure by reference. Edited July 7, 2008 by weaponx
James Posted July 7, 2008 Author Posted July 7, 2008 How do I convert "*pMarInset"? And how do I make margins? Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
weaponx Posted July 7, 2008 Posted July 7, 2008 (edited) Well $tagMargins is already defined for you in StructureConstants.au3. #include<StructureConstants.au3> $tMargins = DllStructCreate($tagMargins) Func ApplyGlass($hWnd, $tRect, $dll = "dwmapi.dll") Return DllCall($dll, "long", "DwmExtendFrameIntoClientArea", "hwnd",$hWnd , "long", DllStructGetPtr($tMargins)); Last long relates to tRect EndFunc or #include<StructureConstants.au3> $tMargins = DllStructCreate($tagMargins) Func ApplyGlass($hWnd, $tRect, $dll = "dwmapi.dll") Return DllCall($dll, "long", "DwmExtendFrameIntoClientArea", "hwnd",$hWnd , "long*", DllStructGetPtr($tMargins)); Last long relates to tRect EndFunc EDIT: I just realized your DllCall parameters weren't in the proper order. It goes "type1", "param1", "type2", "param2". Edited July 7, 2008 by weaponx
James Posted July 8, 2008 Author Posted July 8, 2008 Nevermind, I have got a somewhat working function I made here muttley Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
weaponx Posted July 8, 2008 Posted July 8, 2008 Nevermind, I have got a somewhat working function I made here muttley Maybe I am missing something but this structure is also included with AutoIt. #include<StructureConstants.au3> $tRect = DllStructCreate($tagRECT) DllStructSetData($tRect, "Left", 50) DllStructSetData($tRect, "Top", 50) DllStructSetData($tRect, "Right", 50) DllStructSetData($tRect, "Bottom", 50)
James Posted July 8, 2008 Author Posted July 8, 2008 Maybe I am missing something but this structure is also included with AutoIt. #include<StructureConstants.au3> $tRect = DllStructCreate($tagRECT) DllStructSetData($tRect, "Left", 50) DllStructSetData($tRect, "Top", 50) DllStructSetData($tRect, "Right", 50) DllStructSetData($tRect, "Bottom", 50)Thanks weaponx, but everything is done now muttley check out the examples post! Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
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