Hi all,
I am running a launcher console app, which is developed with native C++ , to launch a Windows Store App. This launcher successfully launches my store app.
When I call my launcher (called from another .NET desktop app via Process class), I dont want the console window to appear even for a moment but I can not prevent it to appear and then disappear instantly. I searched a lot and tried many things to hide it, but I couldn't success. Here is the C++ codes I used for the launcher app;
HRESULT LaunchApp(const std::wstring& strAppUserModelId, PDWORD pdwProcessId){
CComPtr<IApplicationActivationManager> spAppActivationManager;
HRESULT hrResult = E_INVALIDARG;
if (!strAppUserModelId.empty())
{
// Instantiate IApplicationActivationManager
hrResult = CoCreateInstance(CLSID_ApplicationActivationManager,
NULL,
CLSCTX_LOCAL_SERVER,
IID_IApplicationActivationManager,
(LPVOID*)&spAppActivationManager);
if (SUCCEEDED(hrResult))
{
// This call ensures that the app is launched as the foreground window
hrResult = CoAllowSetForegroundWindow(spAppActivationManager, NULL);
// Launch the app
if (SUCCEEDED(hrResult))
{
hrResult = spAppActivationManager->ActivateApplication(strAppUserModelId.c_str(),
NULL,
AO_NONE,
pdwProcessId);
}
}
}
return hrResult;
}
int _tmain(int argc, _TCHAR* argv[])
{
HRESULT hrResult = S_OK;
if (SUCCEEDED(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED)))
{
if (argc == 2)
{
DWORD dwProcessId = 0;
++argv;
hrResult = LaunchApp(*argv, &dwProcessId);
}
else
{
hrResult = E_INVALIDARG;
}
CoUninitialize();
}
return hrResult;
}
Does somebody have any idea about my issue? What kind of modifications should I do?
Kind Regards,
Abdullah DAGLIOGLU