Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Thread Tools Display Modes
Old 01-06-2001, 05:53 AM
gLes gLes is offline
Senior Member
Join Date: Jan 2001
Posts: 2,273
Default How can I "force" Windows to create a link to a specified file?

I'd like to make an install program for my app and I'd like to know which API function can I use to create a link to my app...
Reply With Quote
Old 01-06-2001, 08:12 AM
medialight medialight is offline
Junior Member
Join Date: Nov 2000
Posts: 4
Default RE: How can I "force" Windows to create a link to a specified file?

This should help:

ShlObj, ActiveX, ComObj, Registry;

MyObject: IUnknown;
MySLink: IShellLink;
MyPFile: IPersistFile;
FileName: string;
Directory: string;
WFileName: WideString;
MyReg: TRegIniFile;
MyObject := CreateComObject(CLSID_ShellLink);
MySLink := MyObject as IShellLink;
MyPFile := MyObject as IPersistFile;
FileName := 'C:\Windows\Notepad.exe';

with MySLink do begin
SetArguments('C:\Autoexec.bat'); // Parameters
SetWorkingDirectory(PChar(ExtractFilePath(FileName )));

MyReg := TRegIniFile.Create('Software\MicroSoft\Windows\Cur rentVersion\Explorer');
Directory := MyReg.ReadString('Shell Folders','Desktop','');
WFileName := Directory+'\FooBar.lnk';

Kind Regards,
Serge M.
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump

All times are GMT. The time now is 01:52 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2018, vBulletin Solutions, Inc.