Last active
December 29, 2023 07:28
-
-
Save technoscavenger/c769d8df9410823cc47a8c0da2607dfe to your computer and use it in GitHub Desktop.
Initialize COM Delphi console application
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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