Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Requirement 1

Status
Not open for further replies.

pierrotsc

Programmer
Nov 25, 2007
358
US
My program needs the 2010 Visual C+ redistribution files. Is there a way to check that the computer have it and if not, redirect to the Microsoft page ? (Or even better, start the install for the chosen platform automatically?)

The file that needs to be present is MSVCP100.dll

Thanks.
Pierre
 
Checking for the file is easy enough.

Code:
function libexists(name: string): boolean;
var
  dllhandle: THandle;
begin
  dllHandle := LoadLibrary(PChar(name)) ;
  if dllHandle <> 0 then
    begin
      FreeLibrary(dllHandle);
      Result := true;
    end
  else
    Result := false;
end;

procedure TForm1.Button1Click(Sender: TObject);
const
  libtest = 'MSVCP100.DLL';
begin
  if libexists(libtest) then
    ShowMessage(libtest + ' exists')
  else
    ShowMessage(libtest + ' does not exist.');
end;

As far as what to do about it, you can always just shellexecute the URL you need. As far as determining whether you have that version, I'm not sure if there's a wrinkle involved that might not make this method work.

 
Thanks, let me try that for now. If someone has a better solution, i'll implement it. I know that some programs are able to install all the requirements.

Sincerely,
 
just realized that may not work. i use inno setup to pack my program. so i guess, i'll have to run a script within inno setup. my program does not start if the requirements are not met.i may be able to create a delphi program that starts before the program itself installs.
Thanks for the brainstorming.
 
i think this is what i need. i did create a small delphi program with your code that i am telling inno to run before the install.

thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top