大悟还俗

邮箱 key_ok@qq.com 我的收集 http://pan.baidu.com/share/home?uk=1177427271
  新随笔  :: 联系 :: 订阅 订阅  :: 管理

inf 启动

Posted on 2013-10-21 13:32  大悟还俗_2  阅读(185)  评论(0编辑  收藏  举报

How to install an INF file using Delphi

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;