Coinitialize has not been called error message

前端 未结 1 474
感动是毒
感动是毒 2020-12-21 04:00

I am in the process of coding a console application that will create a firewall exception for my main app called Client.exe which uploads a few documents to our servers via

相关标签:
1条回答
  • 2020-12-21 04:17

    If you want to use COM - objects you will have to call CoInitialize with corresponding CoUninitialize.

    In a usual application this will be already done.
    As far as your program is a console program you will have to call it on your own.

    .....
    CoInitialize(nil);
    try
      try
        { TODO -oUser -cConsole Main : Insert code here }
        ExecName := GetCurrentDir + '\' + 'Client.exe';
        AddExceptionToFirewall('SIP Inventory',ExecName);
      except
        on E: Exception do
          Writeln(E.ClassName, ': ', E.Message);
      end;
    finally
      CoUninitialize;
    end;
    .....
    
    0 讨论(0)
提交回复
热议问题