Hi everybody,

I have run into a very specific problem that involves shutting down of a
multithreaded VBA application through one of many COM interfaces offered by
VBA 6 SDK...My simulation software uses VB as a scripting language, which
has turned out to be quite a flexible soltion and is loved by our customers.

To make things more complicated whenever there are multiple simulation
agents, a separate DLL is created/compiled using available interfaces. It's
all good and fine, until we get to the situation when the user wants to
cancel the simulation. If there is only one simulation agent, a regular

HRESULTS hr = ApcHost->End()

will get the job done. Simulation run finishes instantly.

The problem occurs when number of simulation agents is more than one. Each
one of them has its own compiled VB DLL, its own thread. When user aborts
the simulation, code:

HRESULTS hr = ApcHost->End() fails admirably.

I don't know if it is implementation that's wrong, but the fact is that the
command does not work. After 2 days of digging through VBA/APC interface
descriptions, I'm about to give up trying.

If you have any idea how to solve this problem, please reply. Your help will
be highly appreciated.