simon7341
15 years agoNew Contributor
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?
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?