==========
MultiTDemo
==========

A demonstration of supported multithreading in VB6.


Background
----------

In VB6 Microsoft produced a mechanism to handle multithreading
as part of the Apartment-Threading Model.  Thread pooling and
other capabilities exist, but this example is based on the
Thread-Per-Object threading option.

It is pretty much straight from the book, closely following
the instructions given in the VB6 documentation for a demo
multithreading program.


Note
----

On Vista or later you should be running VB6.EXE *elevated*
whenever you are creating COM libraries (like this one).
Otherwise you will run into component registration issues.


Unregistering
-------------

I have included AxExeUnreg.vbs, a WSH script for unregistering
the compiled ActiveX EXE produced by this project.  I don't like
leaving component entries in the registry for junk and
experiments any more than you probably do.

Usage:  Simply drag the EXE onto the script and drop it, or
        you can run the script from a command prompt.  See
        comments in the script for details.

THE SCRIPT NEEDS CHANGES FOR POST-VISTA VS. PRE-VISTA!
One set of lines will be commented out and you may have to flip
which ones are active.

NOTE:  You should unregister each time before compiling the
       Project again because we're using "No compatibility"
       which means we get new classIDs each compile.  If you
       overwrite the old EXE you cannot easily unregister it!
       The result is a large amount of trash in the registry.


Reregistering
-------------

A fresh compile will register the EXE, but if you used the
AxExeUnreg.vbs script and want to reverse it you can run the
similar AxExeReg.vbs provided.


The Demo
--------

This is a pretty simple one.  You must compile the project.
Testing within the IDE will not result in proper
multithreading action.

A UI form is displayed with a "Start a Thread" button on it.
You may click this button up to 5 times to start up to 5
worker threads.  Each thread simply increments a counter and
displays it on the form based on Timer control ticks.

You can start Task Manager and enable the Threads column in
the Processes tab.  This can be used to monitor the
application's thread count as you add new threads.

Just close the program (close the UI form) to close it all
down.
