Similar Threads
1. How create a desktop shortcut in c#?
Hi,
How do i create an application shortcut on desktop programmically in C#? I
have done some shortcut coding before in visual basic 6 using windows
scripting host but later found out that scripting codes get block by some
application such as Norton and McAfee.
Would anyone mind give me some help or better still give me some sample
code. I would prefer API calls then windows scripting host.
Many thank you in advance.
2. How to create a desktop shortcut? - CSharp/C#
3. creating a shortcut on desktop
Hi,
I need to modify existing MFC based app writen with Visual Studio 6.0, which
is not exactly my cup of tea. One of the things I don't know is how to
create a shortcut in code to existing application. Location of the app is
unknown and will be determined inside the code (otherwise I could simply
copy LNK file). Does anyone know how to do it?
Thanks,
Miroslaw
4. Shortcut no getting created on Windows Vista Desktop
5. Installer prompting to create desktop/start-menu shortcuts
Well, my application is done, and I've successfully created an
installer for it (a .msi file). Unfortunately, I can't seem to figure
out how to get it to prompt the user during installation whether to
place shortcuts on the desktop and/or start menu. In the install file
system on the properties tag for these shortcuts I see a field
"Condition" which says it evaluates this expression to decide whether
or not to actually install these shortcuts. However, I can't seem to
find a way to add question prompts to the installation itself. So I
have no idea what to put in "Condition". Any help? Thanks!
6. Create a Shortcut to a DUN Entry on Desktop
7. Creating and icon shortcut desktop problem
The following code works for notepad and creates a shortcut
but when I put my own params into the directory for example
directory='c:\franchise\myexe.exe' the shortcut icon does not display
hence the shortcut path does not appear
can anyone please tell me what I'm doing wrong to creat nmy own shortcut?
The unit does compile ok just create a new project
the add a button then double click on the button and copy the unit over
unit1
Thanks for any help
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
uses
ShlObj, ActiveX, ComObj, Registry;
procedure TForm1.Button1Click(Sender: TObject);
var
MyObject : IUnknown;
MySLink : IShellLink;
MyPFile : IPersistFile;
FileName : String;
Directory : String;
WFileName : WideString;
MyReg : TRegIniFile;
begin
MyObject := CreateComObject(CLSID_ShellLink);
MySLink := MyObject as IShellLink;
MyPFile := MyObject as IPersistFile;
FileName := 'NOTEPAD.EXE';
with MySLink do begin
// SetArguments('C:\AUTOEXEC.BAT');
SetPath(PChar(FileName));
SetWorkingDirectory(PChar(ExtractFilePath(FileName)));
end;
MyReg := TRegIniFile.Create(
'Software\MicroSoft\Windows\CurrentVersion\Explorer');
// Use the next line of code to put the shortcut on your desktop
Directory := MyReg.ReadString('Shell Folders','Desktop','');
// Use the next three lines to put the shortcut on your start menu
// Directory := MyReg.ReadString('Shell Folders','Start Menu','')+
// '\Whoa!';
// CreateDir(Directory);
WFileName := Directory+'\notepad.lnk';
MyPFile.Save(PWChar(WFileName),False);
MyReg.Free;
end;
end.
8. Creating Shortcut desktop Icon without using registry - Delphi VCL Component