bensonsearch
Well-known Member
- Joined
- May 26, 2011
- Messages
- 844
Hi All,
I have some forms that would be used on different computers and different screen resolutions. I have added min/max buttons on the forms no worries but the items on the form dont line up to the screen size (i think this is the zoom function).
the code im using to do the min/max buttons are below if it matters.
in declarations:
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
Private Const GWL_STYLE As Long = (-16) 'Sets a new window style
Private Const WS_SYSMENU As Long = &H80000 'Windows style
Private Const WS_MINIMIZEBOX As Long = &H20000
Private Const WS_MAXIMIZEBOX As Long = &H10000
Private Const SW_SHOWMAXIMIZED = 3
in userform activate
Dim lFormHandle As Long, lStyle As Long
lFormHandle = FindWindow("ThunderDFrame", Me.Caption)
lStyle = GetWindowLong(lFormHandle, GWL_STYLE)
lStyle = lStyle Or WS_SYSMENU
lStyle = lStyle Or WS_MINIMIZEBOX
lStyle = lStyle Or WS_MAXIMIZEBOX
SetWindowLong lFormHandle, GWL_STYLE, (lStyle)
'ShowWindow lFormHandle , SW_SHOWMAXIMIZED
DrawMenuBar lFormHandle
let me know if there is a way to zoom the form to match the max/min adjustments
I have some forms that would be used on different computers and different screen resolutions. I have added min/max buttons on the forms no worries but the items on the form dont line up to the screen size (i think this is the zoom function).
the code im using to do the min/max buttons are below if it matters.
in declarations:
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
Private Const GWL_STYLE As Long = (-16) 'Sets a new window style
Private Const WS_SYSMENU As Long = &H80000 'Windows style
Private Const WS_MINIMIZEBOX As Long = &H20000
Private Const WS_MAXIMIZEBOX As Long = &H10000
Private Const SW_SHOWMAXIMIZED = 3
in userform activate
Dim lFormHandle As Long, lStyle As Long
lFormHandle = FindWindow("ThunderDFrame", Me.Caption)
lStyle = GetWindowLong(lFormHandle, GWL_STYLE)
lStyle = lStyle Or WS_SYSMENU
lStyle = lStyle Or WS_MINIMIZEBOX
lStyle = lStyle Or WS_MAXIMIZEBOX
SetWindowLong lFormHandle, GWL_STYLE, (lStyle)
'ShowWindow lFormHandle , SW_SHOWMAXIMIZED
DrawMenuBar lFormHandle
let me know if there is a way to zoom the form to match the max/min adjustments