I have a Visual C++ service that is using an ActiveX Exe (Similar to an ActiveX Dll). The service needs to run the following code and create an instance of a connector object from the Active exe. This code is currently working 100%.
If the user starts the service, which calls the RUN command, the connector object gets created correctly. However, if the user logs off the machine while the service is running, the connector object is killed and the service continues to operate. My guess is that I need to specify the Windows NT login when creating the connector object. So if the service is started up by USER1, and the machine is logged in as USER2, the connector object will belong to USER1. That way if the USER2, logs off, the service and connector object still exist.
A couple of ideas that might be part of the solution:
Here is the procedure that creates the connector object in C++.
// I have removed the catch code and I only am showing the try code.
long iLoopCount; //a loop counter
long iRetryCount; //a retry counter
long iStart; //a Return Code for Start MyServer
long iRefresh; //a Return Code for Refresh MyServer
HRESULT hr; //a Return Code of COM
//The following code is to call a VB ActiveX Exe
CoInitialize(NULL); //open a COM thread
_ConnectorPtr aConnector; //a smart point to the VB object
hr = aConnector.CreateInstance(__uuidof(Connector)); //create an instance of a connector object
// Check the status of ?hr? here to ensure that the connector was created
//Start the MyServer
I have lots of experience with VB and RDBMS, but I only have 1 year of C++ knowledge. If your solution requires many steps, please document clearly, as it will help immensely.
Thank you very much for your time,