CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2005
    Posts
    221

    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

  2. #2
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    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).

    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.
    Best regards,
    Igor

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured