CreateOleObject
delphi function internally calls CoAreateInstance WinApi, which requires a raise. You have several options for solving this problem.
1) Adding a manifest to your application, including the requested requireAdministrator run level.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <assemblyIdentity name="Your app name goes here" processorArchitecture="x86" version="5.1.0.0" type="win32"/> <description>your app description goes here</description> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="x86" publicKeyToken="6595b64144ccf1df" language="*" /> </dependentAssembly> </dependency> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> <security> <requestedPrivileges> <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/> </requestedPrivileges> </security> </trustInfo> </assembly>
2) You can start an additional process with a higher level that will perform the task or create a COM object that works with a higher level, you can find more information in these MSDN entries
source share