Re: VB6 DLL




"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.



.



Relevant Pages

  • Re: Multiple DLL, multiple THREADS, multiple applications or something else?
    ... Once DLL is loaded and serial port opened and DLL left in its own ... especially if you re-use the buffers by ... > respond to query from devices on serial port) on a notify base ... ...
    (borland.public.delphi.language.objectpascal)
  • Re: Events do not fire when used in COM DLL
    ... This may be a problem in a COM dll but I don't know if it ... this creates the serial port component ... Enter a wait loop (tried Application.Processmessages and also ... The first button event loads the DLL and brings up a dialogue form. ...
    (borland.public.delphi.language.objectpascal)
  • Re: VB6 DLL
    ... serial port and how it decrypts the data. ... I want to make a DLL that I can ... Public WithEvents MSComm1 As MSComm ... I would like to make a DLL in VB6 that interfaces with a VB6 EXE. ...
    (microsoft.public.vb.general.discussion)
  • Re: sending user defined msg to MFC dll - using serial writer/read
    ... create modeless dialog ... You seem to keep thinking that the DLL is running in a different thread. ... They are separate threads because they represent asynchronous I/O ... you can't use non-overlapped I/O on a bidirectional serial port; ...
    (microsoft.public.vc.mfc)
  • Re: VB2005 registering a dll
    ... the dll and exe have exactly the same code and start in Sub Main. ... If I start the exe version all goes well. ... I interface with a USB device which has 99% of the USB ... There is one USB call that collects Real Time data in the VB6 exe. ...
    (microsoft.public.dotnet.languages.vb)

Loading