Jump to content

Recommended Posts

Posted (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 by JamesBrooks
Posted

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"

Posted (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 by weaponx
Posted (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 by weaponx
Posted

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)
Posted

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!

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...