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 Use an animated cursor?

0 Answers  


How to Copy a information from one memo field to another using TBlobStream ?

0 Answers  


How to Retrieving the program that is associated with a given extension?

0 Answers  


How to Check drive ready status?

0 Answers  


What are the problems faced by memory leaks?

0 Answers  






'Interface mismatch. Engine version different' . what does this error indicates?

0 Answers  


'Missing Data Provider or Data Packet' . what does this error mean?

2 Answers  


How to Propagate constraints from middle-tier to client?

0 Answers  


How do I close a modal form? For that matter, what is the best way to close any form?

0 Answers  


How to get a TRichEdit to scroll in code?

0 Answers  


How to Set a form's maxwidth in code?

0 Answers  


Can I use the ODBC drivers that I got with ?

0 Answers  


Categories