{"id":15,"date":"2007-03-02T15:28:00","date_gmt":"2007-03-02T12:28:00","guid":{"rendered":"http:\/\/pblog.ru\/?p=15"},"modified":"2008-09-09T09:32:55","modified_gmt":"2008-09-09T06:32:55","slug":"%d1%8f%d1%80%d0%bb%d1%8b%d0%ba%d0%b8","status":"publish","type":"post","link":"http:\/\/pblog.ru\/?p=15","title":{"rendered":"\u041e \u044f\u0440\u043b\u044b\u043a\u0430\u0445"},"content":{"rendered":"<p>\u041e\u0441\u043d\u043e\u0432\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u044f\u0440\u043b\u044b\u043a\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435:<br \/>\n\u0412 \u0440\u0430\u0437\u0434\u0435\u043b Uses \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 ShlObj, ActiveX, ComObj, StdCtrls;<br \/>\n  private<br \/>\n   procedure CreateShotCut(SourceFile, ShortCutName, SourceParams: String);<br \/>\n  public<br \/>\n   { Public declarations }<br \/>\n  end;<\/p>\n<p>implementation<\/p>\n<p>procedure TForm1.CreateShotCut(SourceFile, ShortCutName, SourceParams: String);<br \/>\nvar<br \/>\nIUnk: IUnknown;<br \/>\nShellLink: IShellLink;<br \/>\nShellFile: IPersistFile;<br \/>\ntmpShortCutName: string;<br \/>\nWideStr: WideString;<br \/>\ni: Integer;<br \/>\nbegin<br \/>\nIUnk := CreateComObject(CLSID_ShellLink);<br \/>\nShellLink := IUnk as IShellLink;<br \/>\nShellFile  := IUnk as IPersistFile;<\/p>\n<p>ShellLink.SetPath(PChar(SourceFile));<br \/>\nShellLink.SetArguments(PChar(SourceParams));<br \/>\nShellLink.SetWorkingDirectory(PChar(ExtractFilePath(SourceFile)));<\/p>\n<p>ShortCutName := ChangeFileExt(ShortCutName,&#8217;.lnk&#8217;);<br \/>\nif fileexists(ShortCutName) then<br \/>\nbegin<br \/>\nShortCutName := copy(ShortCutName,1,length(ShortCutName)-4);<br \/>\ni := 1;<br \/>\nrepeat<br \/>\ntmpShortCutName := ShortCutName +'(&#8216; + inttostr(i)+ &#8216;).lnk&#8217;;<br \/>\ninc(i);<br \/>\nuntil not fileexists(tmpShortCutName);<br \/>\nWideStr := tmpShortCutName;<br \/>\nend<br \/>\nelse<br \/>\nWideStr := ShortCutName;<br \/>\nShellFile.Save(PWChar(WideStr),False);<br \/>\nend;<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u044f\u0440\u043b\u044b\u043a\u0430 \u0432 \u0430\u0432\u0442\u043e\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043d\u0430\u0434\u043e:<br \/>\n<!--more--><br \/>\nprocedure TForm1.Button1Click(Sender: TObject);<br \/>\nvar<br \/>\nWorkTable:String;<br \/>\nFind:_WIN32_FIND_DATAA;<br \/>\nP:PItemIDList;<br \/>\nC:array [0..1000] of char;<br \/>\nbegin<br \/>\nif SHGetSpecialFolderLocation(Handle,CSIDL_PROGRAMS,p)=NOERROR then<br \/>\nbegin<br \/>\nSHGetPathFromIDList(P,C);<br \/>\nWorkTable:=StrPas(C)+&#8217;\\\u0410\u0432\u0442\u043e\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430&#8217;;<br \/>\nend;<\/p>\n<p> if not DirectoryExists(WorkTable) then<br \/>\nMkDir(WorkTable);<br \/>\n\/\/ \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u044f\u0440\u043b\u044b\u043a\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u044b\u0448\u0435\u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b<br \/>\nCreateShotCut(&#8216;\u041f\u0443\u0442\u044c_\u043a_\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435\\\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430.exe&#8217;, WorkTable+&#8217;\\&#8217;+ExtractFileName(&#8216;\u041f\u0443\u0442\u044c_\u043a_\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435\\\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430.exe&#8217;), &#187;);<br \/>\nend;<\/p>\n<p>\u0418\u043b\u0438 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u044f\u0440\u043b\u044b\u043a\u0430 \u043d\u0430 \u0420\u0430\u0431\u043e\u0447\u0435\u043c \u0441\u0442\u043e\u043b\u0435:<\/p>\n<p>procedure TForm1.Button2Click(Sender: TObject);<br \/>\nvar<br \/>\nWorkTable:String;<br \/>\nFind:_WIN32_FIND_DATAA;<br \/>\nP:PItemIDList;<br \/>\nC:array [0..1000] of char;<br \/>\nbegin<br \/>\nif SHGetSpecialFolderLocation(Handle,CSIDL_DESKTOP,p)=NOERROR then<br \/>\nbegin<br \/>\nSHGetPathFromIDList(P,C);<br \/>\nWorkTable:=StrPas(C);<br \/>\nend;<br \/>\nCreateShotCut(&#8216;\u041f\u0443\u0442\u044c_\u043a_\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435\\\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430.exe&#8217;, WorkTable+&#8217;\\&#8217;+ExtractFileName(&#8216;\u041f\u0443\u0442\u044c_\u043a_\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435\\\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430.exe&#8217;), &#187;);<br \/>\nend;<\/p>\n<p>\u041a\u0441\u0442\u0430\u0442\u0438 \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044f\u0440\u043b\u044b\u043a \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0442\u043e \u0432\u043c\u0435\u0441\u0442\u043e &#8216;\u041f\u0443\u0442\u044c_\u043a_\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435\\\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430.exe&#8217; \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 Application.ExeName<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041e\u0441\u043d\u043e\u0432\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u044f\u0440\u043b\u044b\u043a\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435: \u0412 \u0440\u0430\u0437\u0434\u0435\u043b Uses \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 ShlObj, ActiveX, ComObj, StdCtrls; private procedure CreateShotCut(SourceFile, ShortCutName, SourceParams: String); public { Public declarations } end; implementation procedure TForm1.CreateShotCut(SourceFile, ShortCutName, SourceParams: String); var IUnk: IUnknown; ShellLink: IShellLink; ShellFile: IPersistFile; tmpShortCutName: string; WideStr: WideString; i: Integer; begin IUnk := CreateComObject(CLSID_ShellLink); ShellLink := IUnk as [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3,15],"tags":[304,303,302,301,305],"_links":{"self":[{"href":"http:\/\/pblog.ru\/index.php?rest_route=\/wp\/v2\/posts\/15"}],"collection":[{"href":"http:\/\/pblog.ru\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/pblog.ru\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/pblog.ru\/index.php?rest_route=\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"http:\/\/pblog.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=15"}],"version-history":[{"count":3,"href":"http:\/\/pblog.ru\/index.php?rest_route=\/wp\/v2\/posts\/15\/revisions"}],"predecessor-version":[{"id":219,"href":"http:\/\/pblog.ru\/index.php?rest_route=\/wp\/v2\/posts\/15\/revisions\/219"}],"wp:attachment":[{"href":"http:\/\/pblog.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=15"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/pblog.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=15"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/pblog.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=15"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}