查找调用 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以调用
GetStartupInfo()
填写STARTUPINFO
结构。如果设置了STARTF_TITLEISLINKNAME
标志,则STARTUPINFO::lpTitle
字段包含.lnk
文件的路径。(这在很长一段时间内未记录。它可能一直有效到Win95) 。
You can call
GetStartupInfo()
to fill aSTARTUPINFO
structure. If theSTARTF_TITLEISLINKNAME
flag is set, theSTARTUPINFO::lpTitle
field contains the path to the.lnk
file.(This was undocumented for a long time. It probably works all the way back to Win95).
请参阅此线程 http://social.msdn.microsoft.com/Forums/en-IE/csharplanguage/thread/31cc117e-7726-475c-b9e4-b8041409ce85
我认为命令行参数是唯一的方法。
See this thread http://social.msdn.microsoft.com/Forums/en-IE/csharplanguage/thread/31cc117e-7726-475c-b9e4-b8041409ce85
I think cmd line params are the only way.