LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

ActiveX Server Shutdown Pb

Here is a copy of the question that I posed to NI Support through its
Ask an Engineer website:
"I am writing ActiveX Client S/W in LW/CVI that opens an ActiveX
Server Application, makes use of the methods exposed by its .tlb file,
discards and closes all open documents and handles, and exits normally.
However, when I shut down my Client application, I can see in Task
Manager that the Server process (.exe) file is still open and running.
Is there a way to terminate the Server application from within my Client
application before I exit the LW/CVI program? Does a specific method for
closing the Server application have to be exposed through the ActiveX
Controller that I created in LW/CVI? Or is there some other way to do
this?"

This is NI's response to the "Ask an Engineer" query:
"Thank you for contacting National Instruments."
"The reason that you have an instance of the ActiveX server in your
Task Manager is because all the handles / objects that you have
instantiated in your code, have not been closed. That is the most common
reason for the server process still showing up . The other (unlikely )
is forgetting to quit the server application (this will be a method that
is part of the ActiveX Server, there should always be one, just like you
have an "open_application" or a "new_applciation" you should also have a
"quit_application"). Even if you have quit the program normally, if you
forget to close any of the objects that you may have instantiated , you
will see the server process show up in task manager. There is really no
easy way to determine which one is not closed. One way would be to put
a breakpoint in your code, and check and make sure . Another is to view
the variable values of any object handles that you have opened and make
sure that they are all at 0 when you quit your program.
Hope this helps."
"Please feel free to email / call us if you have any more questions."

Here is NI's response to a Knowledge Base Query response:
"It is up to the ActiveX server Application to provide documentation
on the exposed methods. Some ways to search for a function that might
terminate the ActiveX server are books on ActiveX for that particular
Application, the web, or look through the functions for promising
descriptions. If you need more help, our technical support engineer may
be able to assist you."

I have set those breakpoints and assured myself that all the open and
instantiated handles/objects have been closed and reset to zero. I
guess that only leaves the lack of a "quit_application" method that is
part of the ActiveX Server. I have used the OLE Viewer/ActiveX
Controller Viewer in MSVC++ Tools and I know that the particular ActiveX
Server I am using does not expose such a method (I hate to admit it but
the Server is an "in-house" application). Now the question I have for
you is this: Can I access the Inherited Interface IUnknown's Release
method of the Inherited Interface IDispatch through some kind of ID
Number or Handle that will allow me to utilize the InvokeMethod
function to "quit" the application by releasing its application handle
that was used to launch the Server application? The OLE Viewer/ActiveX
Controller Viewer shows the IUnknown interface as [odl,
uuid(00000000-0000-0000-C000-000000000046), hidden] and the Release
method is [restricted]. Should I be able to InvokeMethod for the
QueryInterface function to input the GUID* riid parameter for the
Application and dereference the void** ppvObj output parameter to
make the call to release the object?

If you guys can't answer this I don't know who can.

Thanks in advance,

Jeff Green
Raytheon Missile Systems


Sent via Deja.com http://www.deja.com/
Before you buy.
0 Kudos
Message 1 of 1
(2,738 Views)