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?
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.
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).