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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to place icon on desk

Status
Not open for further replies.

carlosest

Programmer
Jun 10, 2003
7
0
0
US
I develop accounting program using VFP ver 6.0 and I have not been able to place the program shortcut icon on main screen. Help to do this will be greatly appreciated.

Thanks in advance

carlosest

 
Have you created the installation setup kit?
If you have - what was used to create it, Setup Wizard ("Dullard!" [smile]) or Install Shield?
And mainly: did you attach the icon to the EXE file in the Project Info menu/dialog?

HTH.


Regards,

Ilya
 
Ilya:

Thanks a lot for trying to help me. I used native VFP 6.0 tools to create distribution disks. Icon is included in the .exe. I found Setup Wizard and Install Shield too conversome in addition to price.

Thanks in advance,

crlosest
 
carlosets

I found Setup Wizard and Install Shield too conversome in addition to price.

?? They both come with VFP at no extra cost, I have a feeling it is more of a case of not understanding the product.


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Carlosest,

There are two approaches you can take:

- Create the icon on your own computer, and write a "post-executable setup" to transfer it to the user's system (a batch file will be sufficient).

- Write a little program that calls the Windows Scripting Host. This has a method for creating desktop shortcuts.

You can find code for both the above methods in my article,"Creating desktop icons for Visual FoxPro applications", which is at:

Come back if you have any questions.

Mike


Mike Lewis
Edinburgh, Scotland
 
Mike Gagnon:

Thanks a lot for your advise. I will investigate more about this. Perhaps this is easier than I thought.
Thanks Again. I will let you know about my progress.

Carlosest

 
Mike Kewis:

Thanks for helping me. I will follow your advise and let you know my findings. Thanks agin.

Carloest
 
Mike Lewis
Edinburgh, Scotland

I liked your "The generic method" very much, I just have some clarification.

oShort.TargetPath = "c:\MyApp\MyApp.EXE"

I use the VFP Setup Wizard, in which I give options to change the directory to which the software has to be installed.

In such case how can I decide the target path.


Can you help me out. Thanks in advance.

Regards

Babu






 
Babu,

Hmm. That's a good question. If the user chooses the directory, you've got no way of knowing which directory contains the executable, so you can't create the shortcut. The only solution I can think of is to ask the user again which directory they chose, or search the hard drive for the EXE -- neither option is particularly satisfactory.

I guess that's one of the disadvantages of using the Setup Wizard. With InstallShield Express (or any other proper insatll program), it woulnd't be a problem.

Sorry I can't help.

Mike


Mike Lewis
Edinburgh, Scotland
 
You could always put an entry in the registry of where the product is installed... I keep both the app path and the data path in the registry with my applications. I make the entries using Installshield Professional, dunno if you can do the same with the setup programs being spoken of here.

Slighthaze = NULL

[ul][li]FAQ184-2483
An excellent guide to getting a fast and accurate response to your questions in this forum.[/li][/ul]
 
This is a method I got from MSDN using the VBstkit.dll - I've included it in my Application (in a form method) so everyt time it runs it creates it's own shortcut.

I've modified it a bit, If you want the original, search the MS site (can't remember the URL)

******* CODE BELOW ************


* Heavily cut down version of the microsoft download example
* CREATE DESKTOP SHORTCUT- using shell api fCreateShellLink

lcExeName = "MYEXE.exe" && *~ lcExeName: This is the actual file name (without any path) of the .EXE to create a shortcut to.
lcAppName = "MY EXE NAME" &&*~ lcAppName: This is the name of the application (like "Microsoft Visual FoxPro").

*~ Declare the function in the VB DLL
DECLARE INTEGER fCreateShellLink IN vb6stkit.DLL ;
STRING lpstrFolderName, ;
STRING lpstrLinkName, ;
STRING lpstrLinkPath, ;
STRING lpstrLinkArguments, ;
INTEGER fPrivate, ;
STRING sParent

*~ Set up variables. These variables remain unchanged.
strLinkPath = JUSTPATH(SYS(16,0)) + "\" + lcExeName + CHR(0) && path of current running app
strLinkName = "Shortcut to " + ALLT(lcAppName)
strLinkArguments = "" + CHR(0)
fPrivate = -1
strGroupName = "..\..\Desktop"
sParent = "$(Programs)"

lnSuccess = fCreateShellLink(strGroupName, ;
strLinkName, ;
strLinkPath, ;
strLinkArguments, ;
fPrivate, ;
sParent)

&& error checking removed - just doesn't create shortcut - no message to say yes or no


******* END OF CODE **********
mrF
 
MrF,

Your solution is definitely worth knowing about. Thank you for posting it.

However, the fact that you are doing this:

JUSTPATH(SYS(16,0))

suggests that path in the shortcut will be the path to the EXE of the program which creates the shortcut, not the actual target application.

Babu, if that's what you want, you can use JUSTPATH(SYS(16,0)) in my code as well.

Mike


Mike Lewis
Edinburgh, Scotland
 
MrF & Mike Lewis - Thanks a lot for both of you - I tried this one

PARAMETERS FILENAME
dirname = sys(5)+sys(2003)+"\"+FILENAME+".EXE"
oWsh = CREATEOBJECT("wscript.shell")
cDeskPath = oWsh.SpecialFolders("desktop")
oShort = oWsh.CreateShortcut(cDeskpath+"\"+FILENAME+".LNK")
oShort.TargetPath = dirname
oShort.Save

But I want to give the details to shortcut from which directroy it has to start or working directroy what is the property of oshort in the above example

Regards & Thanks a lot in advance


Babu



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top