Re: VB6 DLL
- From: Jonathan <Jonathan@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 19 Aug 2007 20:58:03 -0700
Steve,
I understand that the ideal would be to do all of the serial work in the
main EXE. However, I want to hide what my software sends and receives to the
serial port and how it decrypts the data. I want to make a DLL that I can
distribute to allow third party customers to access my hardware without being
able to reverse engineer it.
The baud rate for the hardware is slow so the software is waiting for data
most of the time. It can process the data relatively fast. I setup an ActiveX
class with a MSCOMM control like this:
'top of class module
Public WithEvents MSComm1 As MSComm
'initialize in startup routine
Set MSComm1 = New MSComm
Should the OnComm event still trigger in this class when data is recieived?
My code in the on_comm event is not processor intensive and contains lots of
doevents during processing. It mostly just sits there and waits.
I can't figure out how to create a reference to the VB Timer control through
Project > References. I'll need this to tell if there has been a timeout or
lost connection with the hardware. With the timer control, I think I will
have all I need in the ActiveX class. Any ideas what OCX or DLL its in and
how I can create a new instance of a timer at run time?
Thanks for the help.
"Steve Gerrard" wrote:
.
"Jonathan" <Jonathan@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:4C9B85FF-C804-49B1-A5B5-2327CC9174D2@xxxxxxxxxxxxxxxx
Hi,
I would like to make a DLL in VB6 that interfaces with a VB6 EXE. My concern
is that my DLL will be performing long operations with the serial port that
could take up to 2 minutes. My VB6 EXE needs to have some way to update its
GUI with the progress of the operation. After the long process, the DLL needs
to give the EXE data in a large array. I'm a little worried about threading
in VB6.
Well you should be. With a few exceptions, a VB app is strictly single threaded,
and in particular will explode if a second thread attempts to do anything to its
GUI elements.
An ActiveX DLL will not get you another thread. An ActiveX.Exe can do that, but
at the expense of another process as well, with the overhead of marshalling data
between processes, including your large array.
Unless you want to get really hard core about it, it seems to me a better
strategy is to setup the long operation in the main Exe, and then do lots of
work to make sure all processing is in steps, with DoEvents at appropriate
points if needed.
I believe you need to that anyway to work with a serial port effectively. You
typically are waiting for events from the serial port. As you respond to those,
you can update your GUI directly, or, if the code is in a class, raise a
progress event for the main form to receive. You then store the data received,
and go back to waiting for the next serial port event.
- Follow-Ups:
- Re: VB6 DLL
- From: Steve Gerrard
- Re: VB6 DLL
- From: Ken Halter
- Re: VB6 DLL
- References:
- Re: VB6 DLL
- From: Steve Gerrard
- Re: VB6 DLL
- Prev by Date: Re: [VB5) Faster way to read a text file?
- Next by Date: Re: VB6 DLL
- Previous by thread: Re: VB6 DLL
- Next by thread: Re: VB6 DLL
- Index(es):
Relevant Pages
|