How to invoke the Windows ShortCut Dialog wizard?



How to invoke the Windows ShortCut Dialog wizard?..

Answer / editcdc

function InvokeShortCutDialog(Directory : string) : boolean;
var
Reg : TRegistry;
CmdLine : string;
begin
Result := false;
Reg := TRegistry.Create;
try
Reg.Rootkey := HKEY_CLASSES_ROOT;
if Reg.OpenKeyReadOnly('.LNKShellNew') then
begin
CmdLine := Reg.ReadString('Command');
CmdLine := StringReplace(CmdLine, '%1', Directory, []);
Result := True;
WinExec(PChar(CmdLine), SW_SHOWNORMAL );
end
finally
Reg.free;
end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
InvokeShortCutDialog('c:Temp');
end;

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Delphi Interview Questions

How to Create Non-Visual Components Without Icons ?

0 Answers  


How to open or create a project using the TReport component?

0 Answers  


How to Extract RGB components of a color?

0 Answers  


Does Delphi support the back-end?

0 Answers  


How many tables can be connected with joins in oracle at a time?

0 Answers  






Why do I get exception messages even though I am in protected code?

0 Answers  


How can I create an identical binary executable in Delphi?

0 Answers  


What is DBGo?

0 Answers  


How to Use InvalidateRect()to repaint the entire form?

0 Answers  


How to Return application's exit code?

0 Answers  


How to get function params from a dll?

0 Answers  


How to Write a raw string of data to the printer?

0 Answers  


Categories