Results 1 to 10 of 10

Thread: Help me, PLEASE!!

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 1999
    Posts
    13
    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
    Last edited by VBmichael; Feb 1st, 2001 at 06:24 PM.

  2. #2
    Guest
    I believe the LockWindowUpdate API function is what your looking for.


    Code:
    Private Declare Function LockWindowUpdate _
    Lib "user32" (ByVal hwndLock As Long) As Long

  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 1999
    Posts
    13

    Question

    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.

  4. #4
    Addicted Member KrishnaSantosh's Avatar
    Join Date
    Feb 2001
    Location
    Coimbatore
    Posts
    210
    Try Overriding The Form_Resize Event. I Think This Should Work.

  5. #5

    Thread Starter
    New Member
    Join Date
    Jun 1999
    Posts
    13

    Question

    How would you override the FORM_RESIZE Event?

  6. #6
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628
    Odd. My VB projects only show the outlines. Maybe you have some additional software added to VB to make it do that.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

  7. #7
    Addicted Member KrishnaSantosh's Avatar
    Join Date
    Feb 2001
    Location
    Coimbatore
    Posts
    210
    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>

  8. #8
    Guest
    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.

  9. #9
    Guest
    Add to a Module
    Code:
    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
    Code:
    Private Sub Form_Load()
        SubClassWnd hwnd
    End Sub
    
    Private Sub Form_Unload(Cancel As Integer)
        UnSubclassWnd hwnd
    End Sub

  10. #10
    Member
    Join Date
    Jul 1999
    Posts
    42
    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 ?)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width