CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2001
    Posts
    44

    Interesting problem

    I have MDI application generated by VB Wizard.
    While typing text on child form, I use timer to calculate a long task.

    Problem is : when timer starts its calculation, Child form is freezed untill timer finishes its job so I can not type.

    Anyone can help me to solve this problem that I can type as normal when timer doing its job.

    I am thinking about using activeX document to create a out-of-process activeX. Is it a correct solution ?

    Thank you in advance.



  2. #2
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: Interesting problem

    That activeX-out-of-process stuff won't help. VB is single threaded, and in this case, you need more then one thread.

    What you can do is use DoEvents while calculating the stuff. This will return control to the app, and prevents it from freezing. This is very hand when looping.


    ' this will freeze your app
    for t=1 to 100000
    a = a + 1
    next t

    'This doesn't freeze your app
    for t=1 to 100000
    a = a + 1
    DoEvents
    next t




    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

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

Featured