Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to create multiple yet unique desktop shortcuts?
Message
 
 
To
06/11/2002 01:10:58
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00698572
Message ID:
00719285
Views:
32
Elmer,

Yes, I made a VFP exe using George's DLL. Decided it would be a safer route in case of Windows 95...

>Hi Nadya;
>
>I use Setup Factory to create my installs and it has options to automatically create start menu shortcuts and desktop shortcuts. But if you are using the setup wizard in VFP 6, and if it has a way to launch an post-setup exe (I don't remember), I suppose you could create a small exe whose whole purpose is to create your shortcuts using Cre8Shortcut function. Install the exe in the same directory as your application exe and launch it after setup has completed. The post-setup exe would have to check its current location to pass correct paths to Cre8Shortcut to properly create the shortcut to your application.
>
>
>
>HTH
>
>
>>Hi Elmer,
>>
>>How can I use your function in post-setup executable?
>>
>>I'm creating Installation disks (VFP SP4) and I want to automatically create a link for my application on the User's Desktop. How can I do it?
>>
>>Thanks in advance.
>>
>>>>Hi all:
>>>>
>>>>I have the following situation:
>>>>
>>>>- DirectoryA
>>>>- DirectoryB
>>>>- DirectoryC....and so on
>>>>
>>>>Each of these directories contain an executable and will be differentiated i.e., executableA.exe, executableB.exe, executableC.exe and so on.
>>>>
>>>>I would now like to create desktop shortcuts for each of these executables. Result - clikcing on desktop shortcut executableA should only invoke executableA.exe in DirectoryA; likewise clicking on desktop shortcut executableB should only invoke executableB.exe in DirectoryB and so on.
>>>>
>>>>Is this possible at all?
>>>>
>>>>Thank you very much for your time and suggestions.
>>>
>>>This is a function that I use to create shortcuts. I got it from UT API or FAQ section (I think from George Tasker or Ed Rauh) and modified it to my liking.
>>>
>>>
function Cre8Shortcut
>>>	lparameters m.lcLinkname,m.lcApplication,m.cAppParameters,;
>>>	m.lcWorkingdir,m.lcInFolder,m.lcWinstyle,m.lcHotKey, m.cIconLoc
>>>	*!* parameters
>>>	*!* 1. name of link
>>>	*!* 2. Target application or file
>>>	*!* 3. Parameters for target
>>>	*!* 4. Workingdir
>>>	*!* 5. location for shortcut "Desktop"
>>>        *!*        <Default> , "Startup", "Programs" "PROGRAMS\MYFOLDER\"...
>>>	*!* 6. Window Style "MIN" "MAX", "NORM" <DEFAULT>
>>>	*!* 7. startup HOT KEY
>>>	*!* 8. Icon Location - defaults to target file (assumes embedded icon if not passed")
>>>	#DEFINE SC_MAXIMIZED 3
>>>	#DEFINE SC_MINIMIZED 7
>>>	#DEFINE SC_NORMAL    4
>>>	if type("m.lcApplication") <> "C" .or. !file(m.lcApplication)
>>>		return .f.
>>>	endif
>>>	m.lcApplication = locfile(m.lcApplication)
>>>	if type("m.lcLinkname") <> "C"
>>>		m.lcLinkname = juststem(m.lcApplication)+".LNK"
>>>	else
>>>		m.lcLinkname = juststem(m.lcLinkname)+".LNK"
>>>	endif
>>>	if type("m.lcWorkingdir") <> "C" .or. !directory(m.lcWorkingdir)
>>>		m.lcWorkingdir = justpath(m.lcApplication)
>>>	endif
>>>	do case
>>>		case type("m.lcWinstyle") <> "C"
>>>			m.lnWinstyle = SC_NORMAL
>>>		case atc("NORM",m.lcWinstyle) > 0
>>>			m.lnWinstyle = SC_NORMAL
>>>		case atc("MAX",m.lcWinstyle) > 0
>>>			m.lnWinstyle = SC_MAXIMIZED
>>>		case atc("MIN",m.lcWinstyle) > 0
>>>			m.lnWinstyle = SC_MAXIMIZED
>>>		otherwise
>>>			m.lnWinstyle = SC_NORMAL
>>>	endcase
>>>
>>>	*!* Create the Windows Script Host
>>>	loWsh = CREATEOBJECT("Wscript.shell")
>>>
>>>	*!* Locate the user's start up folder
>>>	**lcFolder = loWsh.SpecialFolders("StartUp")
>>>	*lcFolder = loWsh.SpecialFolders("Desktop")
>>>
>>>	do case
>>>		case type("m.lcInFolder") <> "C"
>>>			lcFolder = loWsh.SpecialFolders("Desktop")
>>>			m.lcInFolder = lcFolder
>>>		case atc("Desktop",m.lcInFolder) > 0
>>>			lcFolder = loWsh.SpecialFolders("Desktop")
>>>			m.lcInFolder = strtran(Lower(m.lcInFolder),"desktop\","")
>>>			m.lcInFolder = addbs(addbs(lcFolder)+m.lcInfolder)
>>>		case atc("Startup",m.lcInFolder) > 0
>>>			lcFolder = loWsh.SpecialFolders("StartUp")
>>>			m.lcInFolder = strtran(Lower(m.lcInFolder),"startup\","")
>>>			m.lcInFolder = addbs(addbs(lcFolder)+m.lcInfolder)
>>>		case atc("Programs",m.lcInFolder) > 0
>>>			lcFolder = loWsh.SpecialFolders("Programs")
>>>			m.lcInFolder = strtran(Lower(m.lcInFolder),"programs\","")
>>>			m.lcInFolder = addbs(addbs(lcFolder)+m.lcInfolder)
>>>		otherwise
>>>			m.lcInFolder = addbs(fullpath(m.lcInFolder))
>>>	endcase
>>>	if !empty(m.lcInFolder) .and. cre8dir(m.lcInFolder)
>>>		*!* create specified folder in programs if it does not exist
>>>		lcFolder = m.lcInFolder			
>>>	endif
>>>
>>>	*!* Create a shortcut object
>>>	loShortCut= loWsh.CreateShortcut(addbs(lcFolder) + m.lcLinkname)
>>>
>>>	*!* Set the properties of the shortcut. Note that no error occurs if
>>>	*!* one of the parameters is wrong. The shortcut just won't be saved.
>>>	*!* Also, if the shortcut already exists, it will be overwritten w/o
>>>	*!* warning.
>>>	*!*
>>>	lcAppPath = addbs(JUSTPATH(fullpath(m.lcApplication))) && For example
>>>	lcAppName = justfname(m.lcApplication) && For example
>>>	if type("m.cAppParameters") = "C" .and. !empty(m.cAppParameters)
>>>		loShortCut.Arguments        = m.cAppParameters
>>>	endif
>>>	loShortCut.WorkingDirectory = m.lcWorkingdir
>>>	loShortCut.TargetPath = '"' + lcAppPath + lcAppName + '"'
>>>	loShortCut.IconLocation = iif(type("m.cIconLoc") = "C" .and. ;
>>>               file(m.cIconLoc), m.cIconLoc,loShortCut.TargetPath)
>>>               ** Assumes built-in ICO if not passed
>>>	loShortCut.WindowStyle = m.lnWinstyle
>>>
>>>	if type("m.lcHotKey") = "C"
>>>		loShortCut.HOTKEY = m.lcHotKey && For example
>>>	endif
>>>	*!* Save the shortcut
>>>	loShortCut.SAVE()
>>>
>>>	loShortCut = .null.
>>>	release loShortCut
>>>
>>>	return file(addbs(lcFolder) + m.lcLinkname)
>>>
>>>
>>>You can specify parameters for each shortcut to create. Returns .t. if shortcut is created.
>>>HTH
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform