Solved

Installing INF file programtically?

Posted on 2002-06-03
6
358 Views
Last Modified: 2010-04-04
Here's my situation. I have a third party driver which I need to install prior to my application. I am trying to make this as user friendly as possible, meaning that I would like to eliminate any user intervention for the driver install. How to I programatically simulate a right click/Install of the INF file? Points for working example.

Thanks!!
0
Comment
Question by:DrDelphi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 2

Accepted Solution

by:
freshman3k earned 100 total points
ID: 7051885
Hello!

Here is Working Code:

procedure installInfFile(Inffile: String );
var
Path: string;
VI: TOSVersionInfo;
O: Integer;
begin

 VI.dwOSVersionInfoSize := SizeOf(VI);
 GetVersionEx(VI);
   
 if VI.dwPlatformID = VER_PLATFORM_WIN32_WINDOWS then begin
    Path:='setupx.dll,InstallHinfSection DefaultInstall 130'+InfFile;
    end;
 if VI.dwPlatformID = VER_PLATFORM_WIN32_NT then begin  
    Path:='setupapi.dll,InstallHinfSection DefaultInstall 130'+InfFile;
    end;

 ShellExecute(Handle,'open','rundll32.exe',PChar(Path),nil,SW_SHOWNORMAL);

end;

Example:
installInfFile('c:\myfolder\myinf.inf');

Good Luck! :-)
0
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 7052012
I have converted the SetupApi (http://delphi-jedi.org/APILIBRARY), but i have never used all functions therein.
0
 
LVL 6

Author Comment

by:DrDelphi
ID: 7052030
Testing it out....


0
 
LVL 2

Expert Comment

by:freshman3k
ID: 7052111
Hello Again!

Sorry for my mistakes in the code its just that I was in a hurry!

So here is the corrected code:

procedure installInfFile(InfFile: String );
var
InfFile: String;
VI: TOSVersionInfo;
begin

VI.dwOSVersionInfoSize := SizeOf(VI);
GetVersionEx(VI);
 
if VI.dwPlatformID = VER_PLATFORM_WIN32_WINDOWS then begin
   Path:='setupx.dll,InstallHinfSection DefaultInstall 130'+InfFile;
   end;
if VI.dwPlatformID = VER_PLATFORM_WIN32_NT then begin  
   Path:='setupapi.dll,InstallHinfSection DefaultInstall 130'+InfFile;
   end;

ShellExecute(Handle,'open','rundll32.exe',PChar(Path),nil,SW_SHOWNORMAL);

end;

Example:
installInfFile('c:\myfolder\myinf.inf');
0
 
LVL 1

Expert Comment

by:pnh73
ID: 9010429
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept answer from freshman3k

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Paul (pnh73)
EE Cleanup Volunteer
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi IDE crash without error message ... 7 141
Delphi: ForceDirectory plain function 7 88
Delphi and Access based Enumeration 9 92
Tvertscrollbox like a whatsapp layout 5 69
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question