if POWERPNT.EXE is already running on the machine when the application attempts to create a Power Point Application object that the Application contstructor throws an exception.the error is System.Runtime.InteropServices.COMException (0x80080005): Retrieving the COM class factory for component with CLSID {91493441-5A91-11CF-8700-00AA0060263B} failed due to the following error: 80080005.
From other's help,not to create a new Powerpoint Application instance,I have tried to use Marshal.GetActiveObject("Powerpoint.Application") for getting a running instance , i got another error. Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE)).
my code is
while(Process::GetProcessesByName("POWERPNT")->Length != 1) Sleep(500);
newApp = dynamic_cast<IAPP>(System::Runtime::InteropServices::Marshal::GetActiveObject("Powerpoint.Application"));
if(newApp == nullptr){
newApp = gcnew Microsoft::Office::Interop::PowerPoint::Application();
}else{
***
}
User contributions licensed under CC BY-SA 3.0