Results 1 to 14 of 14

Thread: SOLVED: Is simulated multithreading the way to go (for what i need to do)?

Hybrid View

  1. #1
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: SOLVED: Is simulated multithreading the way to go (for what i need to do)?

    You would need to put DoEvents which should execute at regular intervals in your application. However as the normal DoEvents is very slow, just have a look at this link which provides an alternative faster DoEvents function.

    Give Time to Other Events in My Application


    Pradeep
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  2. #2
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: SOLVED: Is simulated multithreading the way to go (for what i need to do)?

    You can speed it up pretty well by using DoEvents only when it is needed. You can use the GetInputState API function for this.

    VB Code:
    1. Private Declare Function GetInputState Lib "user32" Alias "GetInputState" () As Long
    2.  
    3. Do
    4.     DoSomething
    5.     If GetInputState Then DoEvents
    6. Loop Until Condition = True

    There is another (better) API function to use, but I forgot what it is. Hopefully someone remembers and will post it.

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