COM API across multiple applications
Hi,
I am using an API, which is built using COM. In order to use the API is do the following
Code:
IPSAPIPtr m_APIObject;
m_APIObject.CreateInstance(__uuidof(PSAPI));
HRESULT hr = m_APIObject->Connect(username,passwd);
m_APIObject->setValue(parameters);
m_APIObject->resetvalue(parameters);
There are three applications which are using the interface (PSAPI). Instead of creating a separate instance of the API for each application, i want to create a single instance and connect to the db and all the three applications can use it.
Is it possible to do ? If so , can someone tell what are steps invovled and what kind of project it should be.
Can you please throw some light.
Thanks for all the help !!
BTW all the 3 applications are built VC++ and they are command line.
thanks
Re: COM API across multiple applications
Quote:
Originally Posted by novice123
I am using an API, which is built using COM.
. . .
There are three applications which are using the interface (PSAPI). Instead of creating a separate instance of the API for each application, i want to create a single instance and connect to the db and all the three applications can use it.
Is it possible to do ? If so , can someone tell what are steps invovled and what kind of project it should be.
Can guess it should be local COM server which runs the singleton object.
Another thing I'd to say I dislike the whole design. Why should db connection be exposed such odd way? Does it really needed? The only reason I can imagine is the object might implement some middle-tie business-rule level. But in that case the same might be done by db server itself (of course if it's 'smart' enough).
Quote:
BTW all the 3 applications are built VC++ and they are command line.
Absolutely doesn't matter. Neither whitch tool they made with nor their command-line-ness.