Results 1 to 5 of 5

Thread: Refreshing Forms at Run time without slowing down process

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2000
    Location
    Crowthorne UK
    Posts
    14

    Unhappy

    Does anyone know the best way to refresh a form when in the middle of a complex loop without adding to much time to the loop itself.

  2. #2
    Fanatic Member crispin's Avatar
    Join Date
    Aug 2000
    Location
    2 clicks west of a Quirkafleeg...Cornwall, England
    Posts
    754
    I reckon this might work:

    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    Private Const WM_PAINT = &HF

    Private Sub RefreshForm()
    'probably best to move this line out of the proc,
    'and into the looping procedure instead of
    'calling refreshform every time
    SendMessage Form1.hwnd, WM_PAINT, Form1.hDC, 0&
    End Sub
    Crispin
    VB6 ENT SP5
    VB.NET
    W2K ADV SVR SP3
    WWW.BLOCKSOFT.CO.UK

    [Microsoft Basic: 1976-2001, RIP]

  3. #3
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Code:
    For x=0 to 10000
       if x mod 500=0 then form1.refresh:doevents
    next x
    This will refresh form1 20 times in 10000 loops
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  4. #4

    Thread Starter
    New Member
    Join Date
    May 2000
    Location
    Crowthorne UK
    Posts
    14

    Talking

    Cheers Guys

    Muchos Graciasssss!!!!!!!!!!!!!!!!!1

  5. #5
    Guest
    Refresh should fire off the repaint itself, you should not require the DoEvents.

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