Finding the shortcut a Windows program was invoked from

后端 未结 2 566
生来不讨喜
生来不讨喜 2020-12-11 09:47

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?

相关标签:
2条回答
  • 2020-12-11 10:09

    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.

    0 讨论(0)
  • 2020-12-11 10:15

    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.

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

    0 讨论(0)
提交回复
热议问题