delphi 修改快捷方式


本文整理自网络,侵删。

 delphi 修改快捷方式

function CrnModifyShortcutArguments(strLnkFile:String;strArguments:String):boolean;
var
wszBuf:array [0..MAX_PATH] of widechar;
szBuf :array [0..MAX_PATH] of char;
bResult: boolean;
pShellLink:^IShellLink;
ppf :^IPersistFile;
begin
if not FileExists(strLnkFile) then
begin
MessageBox(0, '指定的快捷方式未找到!', '错误', MB_OK or MB_ICONERROR);
result:= False;
end;
//WideChar(wszBuf,MAX_PATH);
bResult:= (CoInitialize(nil)=S_OK);
//@1
if (bResult) then
begin
bResult:= Boolean(CoCreateInstance(CLSID_ShellLink,nil,CLSCTX_INPROC_SERVER,IShellLink,pointer(pShellLink)) >= 0);
//*@2
if(bResult) then
begin
bResult:= pshellLink^.QueryInterface(IShellLink,pointer(PPF))>= 0;
//*@3
if (bResult) then
begin
bResult:= ppf^.Load(wszBuf, 0) >= 0;
//*@4
if (bResult) then
begin
pShellLink^.SetArguments(pchar(strArguments));
bResult:= ppf^.Save(wszBuf, TRUE) >= 0;
end;
ppf^._Release();
end;
pShellLink^._Release();
end;
CoUninitialize();
end;
result:= bResult;

end;

相关阅读 >>

Delphi 10 seattle的android应用程序的主屏幕上创建快捷方式

Delphi检查是否在64位windows环境中运行?

Delphi windows 编程[11] - wm_size 消息

Delphi dbexpress的upwherekeyonly的使用注意事项

Delphi获取程序自身路径的函数

Delphi unigui中如何监听session的开始与结束

Delphi 切换开关 toggleswitch1

Delphi monthcalendar1 获取选中日期

Delphi Delphi中点击dbgrid某一行获得其详细数据方法

Delphi 拼接文件路径

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...