Click to See Complete Forum and Search --> : Help me, PLEASE!!
VBmichael
Feb 1st, 2001, 11:24 AM
When most programs are resized they only let you move the border of the window until the mouse botton is let up and then the form smoothly resizes itself, but standard VB forms resize the form and update it instantly. So, when you try to add resize code in the forms resize event the whole form flickers.
Does anyone know how to delay the resize event so that you just move the border of a form until the mouse button is let up so that you don't get the flickering.
I think an API call may be needed to do this but I an not sure.
Thanks
I believe the LockWindowUpdate API function is what your looking for.
Private Declare Function LockWindowUpdate _
Lib "user32" (ByVal hwndLock As Long) As Long
VBmichael
Feb 1st, 2001, 08:02 PM
I tried this api call before.
I am not sure whether you understand what I want to do.
I am tring to resize a form like most MS and other programs do, example: Windows Explorer. What they do is when you click and hold on the lower right-hand corner of a window to resize it only an outline of the window moves not whole form. Then when you release the mouse button the window resizes itself into the desired size.
This is what I am trying to accomplish.
KrishnaSantosh
Feb 7th, 2001, 06:24 AM
Try Overriding The Form_Resize Event. I Think This Should Work.
VBmichael
Feb 8th, 2001, 09:30 PM
How would you override the FORM_RESIZE Event?
Lord Orwell
Feb 10th, 2001, 02:47 AM
Odd. My VB projects only show the outlines. Maybe you have some additional software added to VB to make it do that.
KrishnaSantosh
Feb 11th, 2001, 01:13 AM
Did I Tell Override, Just Understand It To Be An Event Handler for Form_Resize.
<color=blue> private sub Form_Resize()
</color>
<color=green>'Process</color>
</color>
Matthew Gates: LockWindowupdate will not work, because that will prevent the window from being updated. To accomplish what VBmichael wants, I'm pretty sure you'd have to subclass.
I'll post the code up as soon as I make it.
Add to a Module
Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Declare Function SetWindowLong& Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long)
Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Const GWL_WNDPROC = (-4)
Const WM_EXITSIZEMOVE = &H232
Global WndProcOld As Long
Public Function WindProc(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
If wMsg = WM_EXITSIZEMOVE Then
'<-- your code here -->
MsgBox "You have finished resizing."
End If
WindProc = CallWindowProc(WndProcOld&, hwnd&, wMsg&, wParam&, lParam&)
End Function
Sub SubClassWnd(hwnd As Long)
WndProcOld& = SetWindowLong(hwnd, GWL_WNDPROC, AddressOf WindProc)
End Sub
Sub UnSubclassWnd(hwnd As Long)
SetWindowLong hwnd, GWL_WNDPROC, WndProcOld&
WndProcOld& = 0
End Sub
Add to a Form
Private Sub Form_Load()
SubClassWnd hwnd
End Sub
Private Sub Form_Unload(Cancel As Integer)
UnSubclassWnd hwnd
End Sub
Alfred
Feb 11th, 2001, 02:16 PM
If you don't want the content of the window to change while you are dragging or resizing you window you have to change your settings:
Control panel > Display > Visual effects: turn off Show windows contents while dragging
With this flag turned off you will only see the broder of the form resizing, not the contents.
(Win 98, Win95 ?)
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.