Forum Discussion

simon7341's avatar
simon7341
New Contributor
14 years ago

Automate AQtime via COM ---- Calls to OpenProject failed

I'm using C++ trying to automate AQtime by means of IntegrationManager. Unfortunately,  I failed to open a project or create a  new project through NewProjectFromModule. Here is the code:




IAQtimeManager* aqTimeManager = NULL;

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





IaqTimeIntegrationSupportManager* IntergrationManager = NULL;

hr = aqTimeManager->get_IntegrationManager( &IntergrationManager );







VARIANT_BOOL result = VARIANT_FALSE;

// NewProjectFromModule return S_OK but the result is VARIANT_FALSE



hr = IntergrationManager->NewProjectFromModule( L"e:\\Work\\Allocation.exe", &result );





// OpenProject return S_OK and the result is VARIANT_TRUE, but actually the project doesn't appear in the AQTime window

// hr = IntergrationManager->OpenProject( L"E:\\Work\\Allocation_exe.aqt" , &result );



// SelectProfiler return S_OK but the result is VARIANT_FALSE



hr = IntergrationManager->SelectProfiler( L"Allocation Profiler", &result );



Now, here are the most curious things: 

First of all, call to OpenProject returns S_OK and result is VARIANT_TRUE,  but I can't find the desired project opened in the AQtime window, which just as starting without a project. 

Secondly, in the AQtime window, I click the "Open Project..." and "New Project From Module..." items on the File menu. Guess what? Nothing happen. However,  clicking "New Project" item will work.



I can't figure out why.

Can you help me?





3 Replies


  • Hi Simon,





    Could you please send us your application that works with AQtime via COM directly via the Contact Support form? We will look into it.





    First of all, call to OpenProject returns S_OK and result is VARIANT_TRUE,  but I can't find the desired project opened in the AQtime window, which just as starting without a project.


    Probably, you are working with an invisible instance of the tool. You need to assign 'true' to the 'Visible' property of the 'IAQtimeManager' interface implemented by the AQtime manager.





    Secondly, in the AQtime window, I click the "Open Project..." and "New Project From Module..." items on the File menu. Guess what? Nothing happen. However,  clicking "New Project" item will work.


    Most probably, AQtime is working in the Silent mode.
  • simon7341's avatar
    simon7341
    New Contributor
    Could you please send us your application that works with AQtime via COM directly via the Contact Support form? We will look into it. 



    Now, I have already copied this post to Contact Support with the application file.



    Probably, you are working with an invisible instance of the tool. You need to assign 'true' to the 'Visible' property of the 'IAQtimeManager' interface implemented by the AQtime manager. 




    Is there a 'Visible' property of the 'IAQtimeManager' interface?  I don't see it.



    Most probably, AQtime is working in the Silent mode.



    How to change to other mode ?

  • Hi Simon,





    Thank you for sending the application. We will look into this case, and I will contact you as soon as we get any results.





    Is there a 'Visible' property of the 'IAQtimeManager' interface?  I don't see it.
    You can work with this property using the corresponding getter and setter methods:







    How to change to other mode ?


    You can get the current run mode in the following way:



      IaqBaseManager* baseManager = NULL;

      aqTimeManager->get_Manager( &baseManager );

      

      TaqRunMode runMode;

      baseManager->get_RunMode( &runMode );

      if (rmSilent == runMode) {

        // Run mode is Silent

      }






    To set the needed run mode, use the 'put_RunMode' method.





    Please note that the run mode is changed to 'Normal' automatically when you make AQtime visible by calling the 'put_Visible' method.