Forum Discussion

constling1's avatar
constling1
New Contributor
13 years ago

How to use AQtime COM?

 i want use c++ code to use it, how can i do and how can i load in the AQtime library?

5 Replies

  • constling1's avatar
    constling1
    New Contributor
    i have two question want to know?

    First:i want to use the AQtime COM server by c++(vs2005),what i need to configuration my project?

    Second:if i want to use the COM server by action , how can i do?

    i have see the use of COM server by C# , it's good。i want to use it by c++ so much  
  • Hi,


    You can work with AQtime via COM by using the IaqBaseManager or IaqTimeIntegrationSupportManager object. Working with the latter is easier, so we recommend that you begin with it.

    Here is an example of obtaining a reference to the IaqTimeIntegrationSupportManager object:




    #include "stdafx.h"

    #include "AQtimeConstants.h"


    int _tmain(int argc, _TCHAR* argv[])

    {

     HRESULT hr;


    // note: the AQtimeConstants.h file misses the declaration of the CProductAQtime constant, we declare it here:

     static const GUID CProductAQtime =     {0x17DD53D6, 0x9408, 0x44A9, {0xB6, 0x5D, 0xE1, 0x3A, 0x96, 0xD5, 0x35, 0x03}};


     hr = CoInitialize(NULL);

     _ASSERT(SUCCEEDED(hr));


     CComPtr<IAQtimeManager> aqTimeManager;

                    hr = CoCreateInstance( CProductAQtime, NULL, CLSCTX_LOCAL_SERVER, __uuidof(IAQtimeManager) , (void**)&aqTimeManager );

                   _ASSERT(SUCCEEDED(hr));


                   CComPtr<IaqTimeIntegrationSupportManager> IntergrationManager;

                   hr = aqTimeManager->get_IntegrationManager( &IntergrationManager );

                  _ASSERT(SUCCEEDED(hr));


     return 0;

    }



    The AQtimeConstants.h file is shipped along with AQtime. You can find it in the <Users>\Public\Documents\AQtime 7 SDK\CPP\Common\ folder (on Windows 7, Windows Vista and Windows Server 2008).