VB6 Threads, easy solution 
Author Message
 VB6 Threads, easy solution

 VB6 Threads, easy solution
 I am in the process of writing a file creation test harness and
experiencing problems with the program locking up when creating large files.
And would like to use VB multi-thread capability to over come this problem.
I have done a lot of reading on the subject and became very confused very
quickly.  I understand VB6 has the ability to use the active X class files
to handle the threads, but what I am having problems with is how to start
them using a thread.  May be I am completely missing the point, but what is
the best way to create threads in VB6 Or multi-tasking ?

 Ideally I am looking for an easy example within VB6 of multi-threads,

 Any ideas are welcome to stop my little brain from hurting.

Thanks in advance

Regards

Brendon Shaw




Wed, 08 Sep 2004 03:06:29 GMT  
 VB6 Threads, easy solution
First, you project type will need to be ActiveX Exe.  The next thing is to
set the project property for threading to "Single Thread Per Object".  Now,
if you want to make a method asynchronous you need to do a little
voodoo...Create an object in your class of type Timer (don't forget to add
WithEvents).  Create a form in the activex exe and put a timer on the form.
Load the form into memory (no need to show it).  Set your local copy of a
timer to the one on the form. Set the timer duration to 1 or 0 ( which ever
works...)  In the public method that you would like to be asyncronous, place
the code to enable the timer.  This will cause the timer to fire almost
immediatly.  Use the event catcher for the timer to actually run your code.
This looks a little screwy ( and it is), but it is how MS suggests to do it.
I have done on quite a few applications and works great.  Just be sure to
load up the task manager and test that objects actually go away when you
expect them too.  If you fail to set an object to Nothing or unload
something...you class may not go away when you expect it to.  Good Luck!
--
TNB (Tim Walsh - You might find me in the yellow pages!)


Quote:
> VB6 Threads, easy solution
>  I am in the process of writing a file creation test harness and
> experiencing problems with the program locking up when creating large
files.
> And would like to use VB multi-thread capability to over come this
problem.
> I have done a lot of reading on the subject and became very confused very
> quickly.  I understand VB6 has the ability to use the active X class files
> to handle the threads, but what I am having problems with is how to start
> them using a thread.  May be I am completely missing the point, but what
is
> the best way to create threads in VB6 Or multi-tasking ?

>  Ideally I am looking for an easy example within VB6 of multi-threads,

>  Any ideas are welcome to stop my little brain from hurting.

> Thanks in advance

> Regards

> Brendon Shaw





Sun, 12 Sep 2004 04:33:41 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. VB6 Threads, easy solution

2. VB6 Threads, easy solution

3. VB6 Threads, easy solution

4. VB6 Threads, easy solution

5. VB6 Threads, easy solution

6. VB6 Threads, easy solution

7. VB6 Threads, easy solution

8. VB6 Threads, easy solution

9. HOW CAN ADD DATABASE INTO VB 6 PROJECT SOLUTION ?SORRY NO THREAD P

10. Any Answers - Easy Problem no solution

11. Easy Cryptography solution ?

12. easy solution

 

 
Powered by phpBB® Forum Software