09-15-2009 06:42 AM
Hi,
I have an ActiveX Object (HyperAccess) that uses the ActiveXAdapter.
Is i created during runtime. The communication is working fine.
But i am not able to call ReleaseDispatch. Its not accessible the HyperAccess interace.
It there a way to release ActiveX (IDispatch) Objects during runtime?
Juergen
Solved! Go to Solution.
09-15-2009 09:03 AM
Just set all the variables storing the reference to Nothing.
Example:
Locals.MyActiveXReference = Nothing
Reference counting is handled automatically by Object Reference variables. If you have the activeX step set to create the object at load/unload time you will need to unload the step too though (but this is not the default setting).
Hope this helps,
-Doug
09-16-2009 02:48 AM
Hi Doug,
It seems this is right! Thanks.
But it is not working correctly after setting to nothing the Programm is crashing with an exception.
I have written a small c++ project to verfiy this behavoir. There I used the same funtions calls as in TS.
There was no crashing.
But i also realized that there is a problem with the programm itself. If makeing the HyperAccess Window once visible
you never will be able to remove the process.
So to save time, i will do a workaround by hooking the window with AutoIt and send ALT-F4
Greetings
Juergen
09-16-2009 08:45 AM
One difference might be that TestStand releases objects in a separate thread. In a well behaved COM/ActiveX server this should not matter and should be handled by the COM/ActiveX threading model. If, however, the server was not written with the correct COM threading model then this might lead to problems. If your server is an in process .dll server and interacts with windows (which have thread affinity) and thus always needs to be called from the same thread, it should be an STA - Single Threaded Apartment server rather than an MTA - Multithreaded Apartment server. If this server is one you have source code to, you might want to check to see if that is the problem.
Hope this helps,
-Doug