Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get 'Shortcut Name'

Status
Not open for further replies.

chrowland

Programmer
May 3, 2006
5
US
I have a single executable with 2 shortcuts on my desktop that point to it, idential except for the name displayed on the desktop. One says 'New FP APP number one', the other says 'Copy of APP number one'. Anyone know how I display either of these strings based on which shortcut I use to start the app?

Thanks.
 

In the Target field of the shortcut's properties, add a command-line parameter - a different one for each shortcut.

For example, if the app is called FP_App.EXE, the Targets could be:

"c:\program files\myapps\fp_app.exe Copy"

and

"c:\program files\myapps\fp_app.exe New"

Then, at the start of your main program, add:

LPARAMETERS tcParam

tcParam will contain either "Copy" or "New", depending on which shortcut was used.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
To Add to what Mike said:

I see no real chance to detect the shortcut itself, which was used to start your application. If there is a way to tell that the OS has to give that information, as the shortcut functionality is outside of the started application. I fear even WinAPI has no function to tell the "last used shortcut" or something like that.

You can set a work directory in the shortcuts. If you set different workdirs maybe a curdir() would also tell you which shortcut was used. But only unless a user changes the shortcuts.

Bye, Olaf.
 
Well guys, thanks for thinking about it. I want to show what the user 'Renamed' it to, though, so I can't use a parameter or separate config.fpw files or something like that. I was hoping there was a simple WinApi call I hadn't found... Seems like there should be.

 

What you can do is to loop through all the shortcuts on the desktop. For each desktop, you can find its name (the name that appears to the user) and also its target. Would that be useful?

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Yes, I thought of that, but I don't think it will work if there is more than one icon on the desktop pointing to the same target.
 
Well I suppose I don't really 'need' to. On a project I am working on some users test new versions of the software and have different shortcut names for the 'live' executable vs. the 'test' executable and it would be convienient to just take the shortcut name and add it to the caption. Obviously there are other ways around this, but it seems like there should be a simple function call to return a structure with all the data from the calling shortcut...

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top