請問如何用編程實現為程序建立捷徑?
如我要為c:\test.exe在桌面建立一捷徑,如何寫?
另外要在桌面上建立一網址的捷徑又該如何?

解决方案 »

  1.   

    procedure CreateShortCut(ShortCut, Application, Parameters, WorkDir:
    string; SW_State: Integer; IconFile: string; IconIndex: Byte);
    var
      SCObject: IUnknown;
      SCSLink: IShellLink;
      SCPFile: IPersistFile;
      WFName: WideString;
    begin
      SCObject := CreateComObject(CLSID_ShellLink);
      SCSLink := SCObject as IShellLink;
      SCPFile := SCObject as IPersistFile;
      SCSLink.SetPath(PChar(Application));
      SCSLink.SetArguments(PChar(Parameters));
      SCSLink.SetWorkingDirectory(PChar(WorkDir));
      SCSLink.SetShowCmd(SW_State);
      SCSLink.SetIconLocation(PChar(IconFile), IconIndex);
      WFName := ShortCut;
      SCPFile.Save(PWChar(WFName), False);
    end;
      

  2.   

    使用Delphi建立文件的快捷方式http://www.china-askpro.com/msg4/qa60.shtml
      

  3.   

    Google找了
    好多例子的http://lysoft.7u7.net