Skip to content

Instantly share code, notes, and snippets.

@technoscavenger
Last active December 29, 2023 07:28
Show Gist options
  • Save technoscavenger/c769d8df9410823cc47a8c0da2607dfe to your computer and use it in GitHub Desktop.
Save technoscavenger/c769d8df9410823cc47a8c0da2607dfe to your computer and use it in GitHub Desktop.
Initialize COM Delphi console application
program Project1;
{$APPTYPE CONSOLE}
{$R *.res}
uses
ActiveX,
ComObj,
System.SysUtils,
Xml.XMLDoc,
Xml.XMLIntf;
var
XmlDoc: IXMLDocument;
begin
try
try
CoInitializeEx(nil,
ActiveX.COINIT_MULTITHREADED
);
XmlDoc := LoadXMLDocument('test.xml');
XmlDoc._Release;
XmlDoc := nil;
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
finally
CoUninitialize;
end;
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment