Fórum Atalho #150216
28/03/2003
0
Anonymous
Curtir tópico
+ 0Posts
28/03/2003
Carnette
Criar atalho no desktop
Coloque essas units na seção implementation :
uses ShlObj, ActiveX,ComObj, Registry;
Por último, crie uma procedure que faça o trabalho:
procedure CreateShortcut (FileName, Parameters, InitialDir, ShortcutName, ShortcutFolder : String);
var
MyObject : IUnknown;
MySLink : IShellLink;
MyPFile : IPersistFile;
Directory : String;
WFileName : WideString;
MyReg : TRegIniFile;
begin
MyObject := CreateComObject(CLSID_ShellLink);
MySLink := MyObject as IShellLink;
MyPFile := MyObject as IPersistFile;
with MySLink do
begin
SetArguments(Parameters);
SetPath(PChar(FileName));
SetWorkingDirectory(PChar(InitialDir));
end;
MyReg := TRegIniFile.Create(´Software\MicroSoft\Windows\CurrentVersion\Explorer´);
Directory := MyReg.ReadString (´Shell Folders´,´Desktop´,´´);
WFileName := Directory + ´\´ + ShortcutName + ´.lnk´;
MyPFile.Save (PWChar (WFileName), False);
MyReg.Free;
end;
Gostei + 0
28/10/2005
Vagner.oliveira
Criar atalho no desktop
Coloque essas units na seção implementation :
uses ShlObj, ActiveX,ComObj, Registry;
Por último, crie uma procedure que faça o trabalho:
procedure CreateShortcut (FileName, Parameters, InitialDir, ShortcutName, ShortcutFolder : String);
var
MyObject : IUnknown;
MySLink : IShellLink;
MyPFile : IPersistFile;
Directory : String;
WFileName : WideString;
MyReg : TRegIniFile;
begin
MyObject := CreateComObject(CLSID_ShellLink);
MySLink := MyObject as IShellLink;
MyPFile := MyObject as IPersistFile;
with MySLink do
begin
SetArguments(Parameters);
SetPath(PChar(FileName));
SetWorkingDirectory(PChar(InitialDir));
end;
MyReg := TRegIniFile.Create(´Software\MicroSoft\Windows\CurrentVersion\Explorer´);
Directory := MyReg.ReadString (´Shell Folders´,´Desktop´,´´);
WFileName := Directory + ´\´ + ShortcutName + ´.lnk´;
MyPFile.Save (PWChar (WFileName), False);
MyReg.Free;
end;[/quote:cd538695e8]
Pô :shock: Copiou a mesma coisa dos outros tópicos
da erro esse código na linha [b:cd538695e8]SetArguments(Parameters); [/b:cd538695e8]
Incompatible types String and PChar
Gostei + 0
28/10/2005
Rômulo Barros
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)