掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
ショートカット作成 (ID:20674)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
{ショートカットファイルを作成する} function CreateShortcut(aAppHandle :HWND; aShortCutDir :String; //ショートカット作成フォルダ aFileName :String; //ショートカットファイル名 aExePath :String; //アプリケーションパス aArguments :String=''; //コマンドライン引数(省略可) aWorkFolder :String=''; //作業フォルダ(省略可) aIconPath :String=''; //アイコンを表示するパス(省略可) aIconIndex :Integer=0) //アイコンのインデックス(省略可) :Boolean; var shellLink: IShellLink; persistFile: IPersistFile; filePath: String; filePathChar: array[0..MAX_PATH*2-1] of Char; begin Result := True; {CreateComObject} shellLink := CreateComObject(CLSID_ShellLink) as IShellLink; persistFile := shellLink as IPersistFile; {プログラムパス} shellLink.SetPath(PChar(aExePath)); {コマンドライン} if aArguments <> '' then shellLink.SetArguments (PChar(aArguments )); {作業フォルダ} if aWorkFolder <> '' then shellLink.SetWorkingDirectory(PChar(aWorkFolder)); {shellLink.SetDescription(PChar(aFileName));} if aIconPath <> '' then begin shellLink.SetIconLocation(PChar(aIconPath), aIconIndex); end else begin shellLink.SetIconLocation(PChar(aExePath), 0); end; {ショートカットファイル名} filePath := aShortCutDir + '\' + aFileName + '.lnk'; {WideChar変換} MultiByteToWideChar(0, 0, PChar(filePath), -1, @filePathChar, MAX_PATH * 2); {保存} persistFile.Save(@filePathChar, True); end;
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.