NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with RegisterClass

Hello,

 

I am trying to call a DLL from within TestStand. When I call the init exit functions the first time, everything works great but when I try to do the same the second time I get a runtime erro which causes teststand to crash. The error seems to be related to a call to RegisterClass from within this DLL, possibly the windows class not unregistering when I exit. I am not able to make any changes to this DLL so is there a way to get past this from within TestStand?

0 Kudos
Message 1 of 2
(3,347 Views)

The easiest workaround would be to never unload the dll (assuming this doesn't cause some other problem for you). You can cause this to happen by calling LoadLibrary on the full path to your dll.

 

More details about what might be causing your problem:

 

UnregisterClass fails if their are any windows of that class still existing. Make sure you have destroyed all the windows of that class first.

 

http://msdn.microsoft.com/en-us/library/ms644899%28VS.85%29.aspx

 

That said, there is very little that is safe to do DLLMain (not sure if you are using dllmain, it is unclear from your post, but just in case). Rather than use DLLMain it is better to export an initialize() and cleanup() function from your dll and call those at the right time from TestStand.

 

Hope this helps,

-Doug

0 Kudos
Message 2 of 2
(3,330 Views)