开发者

Automatically install driver in delphi

How can i install a driver using delphi ?

I have a device that i connect through the usb port and needs some drivers to be installed i can do this by installing it manually but how can i do this automatically ? How does windows know开发者_JAVA百科 that that driver is for that device ?


I found this

>  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;

I will test it and come back with a result


Delphi isn't the natural choice for writing an installer. Instead you should use one of the many products dedicated to creating install packages, e.g.

  • InstallShield
  • InstallAware
  • NSIS
  • WiX
  • Wise
  • InnoSetup
  • etc.

Of these InnoSetup uses a Pascal variant as its scripting language and so is a very popular choice amongst Delphi developers.


Study the source code of InnoSetup. Its available for download at the InnoSetup home page. If that's not enough, there are numerous examples of scripts and helper functions available for InnoSetup with tons of information. We made an installer the same way 15 years ago and it's still in operation without changes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜