查找调用 Windows 程序的快捷方式 [英] Finding the shortcut a Windows program was invoked from

查看:46
本文介绍了查找调用 Windows 程序的快捷方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法让 Windows 程序找出调用它的快捷方式(即 .lnk 文件)(如果有的话),以便它可以选择快捷方式的图标?

Is there a way for a Windows program to find out what shortcut (i.e. .lnk file), if any, it was invoked from, so that it can pick up the shortcut's icon?

推荐答案

您可以拨打 GetStartupInfo() 填充 STARTUPINFO 结构.如果设置了 STARTF_TITLEISLINKNAME 标志,STARTUPINFO::lpTitle 字段包含 .lnk 文件的路径.

You can call GetStartupInfo() to fill a STARTUPINFO structure. If the STARTF_TITLEISLINKNAME flag is set, the STARTUPINFO::lpTitle field contains the path to the .lnk file.

(这是很长一段时间未记录.它可能一直有效到 Win95).

(This was undocumented for a long time. It probably works all the way back to Win95).

这篇关于查找调用 Windows 程序的快捷方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆