Discussion:
Multi Threading Application using VB6.0
(too old to reply)
n***@gmail.com
2006-12-29 07:02:57 UTC
Permalink
hi to all,

i will be thankful to you if you provide me the best way to implement
the multi threading concept using VB6.0.

in present application i am using two Timers and this application is
interfacing with Hardware (PCI based CARD) which is used to send and
recieve the data. we are getting some realtime problems like when we
are moving the mouse and opening other applications, data is missing in
realtime.

So using multi threading will solve my problem, please suggest.i have
to use VB6.0 anyway.

Thank in Advance

Narwa
Rajneesh Noonia
2006-12-29 10:16:22 UTC
Permalink
Please review the techinique used in coffee project that comes alone
with vb6.0 CD under samples and visit link
http://www.vbaccelerator.com/home/VB/Code/Libraries/Threading/index.asp
for multithreading...

Regards
Rajneesh
Post by n***@gmail.com
hi to all,
i will be thankful to you if you provide me the best way to implement
the multi threading concept using VB6.0.
in present application i am using two Timers and this application is
interfacing with Hardware (PCI based CARD) which is used to send and
recieve the data. we are getting some realtime problems like when we
are moving the mouse and opening other applications, data is missing in
realtime.
So using multi threading will solve my problem, please suggest.i have
to use VB6.0 anyway.
Thank in Advance
Narwa
MikeD
2006-12-29 13:17:30 UTC
Permalink
Post by n***@gmail.com
hi to all,
i will be thankful to you if you provide me the best way to implement
the multi threading concept using VB6.0.
in present application i am using two Timers and this application is
interfacing with Hardware (PCI based CARD) which is used to send and
recieve the data. we are getting some realtime problems like when we
are moving the mouse and opening other applications, data is missing in
realtime.
So using multi threading will solve my problem, please suggest.i have
to use VB6.0 anyway.
VB doesn't have much support for "multi-threading". The runtime is not
thread-safe, so you can't create a new free thread with any kind of
stability. The only "multi-threading" you can do is creating ActiveX
components and setting options withing the Theading Model frame on the
General tab of Project Properties.

You might want to look into creating an ActiveX EXE, which would be a
complete and separate process.

However, I wouldn't be so sure that multi-threading or even a different
process is going to solve your problem.
--
Mike
Microsoft MVP Visual Basic
J French
2006-12-29 13:44:53 UTC
Permalink
On Fri, 29 Dec 2006 08:17:30 -0500, "MikeD" <***@nowhere.edu>
wrote:

<snip>
Post by MikeD
You might want to look into creating an ActiveX EXE, which would be a
complete and separate process.
I agree
Post by MikeD
However, I wouldn't be so sure that multi-threading or even a different
process is going to solve your problem.
It probably would, if the 'real time' is not too fast

The OP would need an EXE that runs on its own, pulling in the 'real
time' data and storing it in a queue.

The EXE with the user interface would need to access the other EXE
rapidly as a 'pull mechanism'

The data reading EXE would not be able to Raise Events or use blocking
communication like SendMessage, but it could use PostMessage as an
'uncertain' notifying mechanism.

One could use an AX EXE, but IMO and IME it is easier and more
reliable replicating the relevant behaviour of an AX EXE in standard
EXEs
Mark Yudkin
2006-12-29 13:02:53 UTC
Permalink
There is no multi threading concept using VB6.0. You can:
1) code a thread-safe COM DLL that can be run within an appartment threaded
hosting environment.
2) multi-process (as suggested by Rajneesh).

That said Matthew Curland's book has information on how to do
multi-threading in VB6.

I highly doubt that you can do what you want to do with VB6. And frankly,
since you seem to be polling the card, rather than having an interrupt based
device driver that will do the queuing, I highly doubt that you can do what
you want to do with Windows XP - regardless of the programming language or
techniques you use.
Post by n***@gmail.com
hi to all,
i will be thankful to you if you provide me the best way to implement
the multi threading concept using VB6.0.
in present application i am using two Timers and this application is
interfacing with Hardware (PCI based CARD) which is used to send and
recieve the data. we are getting some realtime problems like when we
are moving the mouse and opening other applications, data is missing in
realtime.
So using multi threading will solve my problem, please suggest.i have
to use VB6.0 anyway.
Thank in Advance
Narwa
Tony Proctor
2006-12-31 11:14:47 UTC
Permalink
I have to contradict you there Mark. We use VB multi-threading a lot here.
Although I fully appreciate that MTA threading is not directly possible in
VB6, STA thread is possible. An ActiveX EXE eve has project options to
create threads per object, or fixed-size thread pools. There are also ways
to force such multi-threaded ActiveX EXE's to run in standalone mode, and so
remove the limitation that you must have a separate process.

Tony Proctor
Post by Mark Yudkin
1) code a thread-safe COM DLL that can be run within an appartment threaded
hosting environment.
2) multi-process (as suggested by Rajneesh).
That said Matthew Curland's book has information on how to do
multi-threading in VB6.
I highly doubt that you can do what you want to do with VB6. And frankly,
since you seem to be polling the card, rather than having an interrupt based
device driver that will do the queuing, I highly doubt that you can do what
you want to do with Windows XP - regardless of the programming language or
techniques you use.
Post by n***@gmail.com
hi to all,
i will be thankful to you if you provide me the best way to implement
the multi threading concept using VB6.0.
in present application i am using two Timers and this application is
interfacing with Hardware (PCI based CARD) which is used to send and
recieve the data. we are getting some realtime problems like when we
are moving the mouse and opening other applications, data is missing in
realtime.
So using multi threading will solve my problem, please suggest.i have
to use VB6.0 anyway.
Thank in Advance
Narwa
Mark Yudkin
2006-12-31 12:33:57 UTC
Permalink
This post might be inappropriate. Click to display it.
Schmidt
2006-12-30 16:45:00 UTC
Permalink
Post by n***@gmail.com
hi to all,
i will be thankful to you if you provide me the best way to implement
the multi threading concept using VB6.0.
Look at this demo:
www.datenhaus.de/Downloads/HeartBeatDemo.zip

It demonstrates InProcess-Threading and SharedData-
Access with VB6 and simulates a simple Hardware-Device
in the "Device-Thread". The incoming data in the Device-
Thread is stored in a RingBuffer-Queue, wich is visible
to both Threads (the MainThread and the DeviceThread).

Olaf
Loading...