Click to See Complete Forum and Search --> : Can I use threads in visual basic 6?
cnavas
Sep 18th, 2002, 02:22 PM
Hi!
I'm developing Activex component in visual basic 6 and it need to used a thread in it.
Can I use threads in?
How can I do it?
thanks
cnavas
deja
Sep 22nd, 2002, 03:09 AM
u can take advantage of threads only in ActiveX EXE.
when u create ActiveX EXE, u can specify weather u want new thread for each client, a pool of threads or single thread to all of the clients.
an ActiveX DLL always run in the thread who create it (STA), it means that it cannot accessed concurrently by two or more clients.
VB don't give u the freedom to create COM object that can handle multiple calls concurrently (ie MTA object).
so take care of creating ActiveX EXE, because the objects creating in a different process, and matters like marshaling overhead etc. must considered.
PT Exorcist
Sep 22nd, 2002, 08:58 PM
you can be API i think...
jim mcnamara
Sep 23rd, 2002, 02:28 PM
You can call CreateThread() in VB -it's a VB function. But you can only use it when you compile to pcode.
deja
Sep 24th, 2002, 01:47 AM
i read the comments that the other fellows suggest and i have something very important to say:
don't ever use the function CreateThread in vb.
u should read and understand very well COM Apartments before get writing some thread code.
link to the following for more info:
http://www.desaware.com/articles/threadingL3.htm
http://codeguru.earthweb.com/activex/COMApartments1.html
cnavas
Sep 24th, 2002, 07:36 AM
Thanks for your help!:)
Cander
Sep 24th, 2002, 03:20 PM
the api is not very stable though.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.