camper12
asked on
32 bit and 64 bit excel vba
Hi,
I am currently using the following code to display a form with rounded windows. Issue is how to make it run in 64-bit.
Thanks
I am currently using the following code to display a form with rounded windows. Issue is how to make it run in 64-bit.
Thanks
Option Explicit
' Region API functins Requires Windows NT 3.1 or later; Requires Windows 95 or later
Private Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function CreatePolygonRgn Lib "gdi32" (lpPoint As POINTAPI, ByVal nCount As Long, ByVal nPolyFillMode As Long) As Long
Private Declare Function CreateRoundRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hWnd As Long, lpRect As RECT) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Dim FrmWndh As Long
Sub SetWindowShape(ByVal hWnd As Long)
Dim lpRect As RECT
Dim lFrmWidth As Long, lFrmHeight As Long
Dim hRgn As Long
GetWindowRect hWnd, lpRect
lFrmWidth = lpRect.Right - lpRect.Left
lFrmHeight = lpRect.Bottom - lpRect.Top
' create a region
hRgn = CreateRoundRectRgn(0, 0, lFrmWidth, lFrmHeight, 40, 40)
' trim the window to the region
SetWindowRgn hWnd, hRgn, True
DeleteObject hRgn
End Sub
Private Sub UserForm_Initialize()
FrmWndh = FindWindow("ThunderDFrame", Me.Caption)
SetWindowShape FrmWndh
HideTitleBar Me
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.