VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Make a Sizeable Control

D Lee  (1 Submission)   Windows API Call/Explanation   Visual Basic 5.0   Advanced   Wed 3rd February 2021

This code allows you to make a non-sizeable control in VB 6.0, to a sizeable control.

Inputs
X as Control Y as Form

Assumes
Thanks to Randy Birch, for most of the code, I encapsulated it as a class, hence: 'to use the class, create a Form1 and Textbox1 Dim clsA as clsUser Set clsA = New clsUser clsA.SetControlResize(Textbox1, Me) Set clsA = Nothing

API Declarations
Option Explicit
'windows constants
Private Const SWP_DRAWFRAME As Long = &H20
Private Const SWP_NOMOVE As Long = &H2
Private Const SWP_NOSIZE As Long = &H1
Private Const SWP_NOZORDER As Long = &H4
Private Const SWP_FLAGS As Long = SWP_NOZORDER Or SWP_NOSIZE Or _
SWP_NOMOVE Or SWP_DRAWFRAME
Private Const GWL_STYLE As Long = (-16)
Private Const WS_THICKFRAME As Long = &H40000
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 SetWindowPos Lib "user32" _
(ByVal hwnd As Long, _
ByVal hWndInsertAfter As Long, _
ByVal X As Long, _
ByVal Y As Long, _
ByVal cx As Long, _
ByVal cy As Long, _
ByVal wFlags As Long) As Long

Rate Make a Sizeable Control (3(3 Vote))
Make a Sizeable Control.bas

Make a Sizeable Control Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters