1. Computing

How to install an INF file using Delphi

From , former About.com Guide

If you need to install an "inf" file using Delphi, you could use the next code:

~~~~~~~~~~~~~~~~~~~~~~~~~
{
Usage:
   InstallINF('C:\XYZ.inf', 0) ;
}
uses
   ShellAPI;

function InstallINF(const PathName: string; hParent: HWND): Boolean;
var
   instance: HINST;
begin
   instance := ShellExecute(hParent,
     PChar('open'),
     PChar('rundll32.exe'),
     PChar('setupapi,InstallHinfSection
           DefaultInstall 132 ' + PathName),
     nil,
     SW_HIDE) ;

   Result := instance > 32;
end;

~~~~~~~~~~~~~~~~~~~~~~~~~

Delphi tips navigator:
» How to determine if a string matches a pattern
« Delphi Enum to String

©2013 About.com. All rights reserved.