Hi all,

Sorry, this is tangentally VFP related at best. I'm trying to figure out
how to programatically drop a shortcut to a vfp executable into the startup
programs. The format of such a file seems to escape me, but looks more like
a table header than a text file. Has anyone done this?

TIA,

John

Re: OT: Creating a .lnk file by Eric

Eric
Mon Nov 24 17:08:57 CST 2003

Hello, John!
You wrote on Mon, 24 Nov 2003 16:04:26 -0700:

JS> Sorry, this is tangentally VFP related at best. I'm trying to figure
JS> out how to programatically drop a shortcut to a vfp executable into the
JS> startup programs. The format of such a file seems to escape me, but
JS> looks more like a table header than a text file. Has anyone done this?

I found this code in my archives:
<vfp_code>
LOCAL lcExecutable, lcShortLNK, lcDesktopFolder
LOCAL Array laShortCutInfo[2,2]

laShortcutInfo[1,1] = "MyFirstExe.exe"
laShortcutInfo[1,2] = "MyFirstExe.lnk"
laShortcutInfo[2,1] = "MySecondExe.exe"
laShortcutInfo[2,2] = "MySecondExe.lnk"
oShell = create("wscript.shell")

if type('oShell') = "O" and not isnull(oShell)
lcDesktopFolder= addbs(oShell.SpecialFolders("desktop"))
for lnI = 1 to alen( laShortcutInfo,1)
lcExecutable = laShortcutInfo[lnI,1]
lcShortLNK = laShortcutInfo[lnI,2]

if file( (lcExecutable) )
oShortCut = oShell.CreateShortcut(
addbs(lcDesktopfolder)+lcShortLNK)

With oShortcut
.Targetpath= addbs(fullpath( curdir()))+lcExecutable
.WorkingDirectory= addbs(fullpath( curdir()))
.WindowStyle = 2
.save()
endwith
endif
endfor
messagebox("Shortcut(s) created on your desktop"+chr(13)+"maybe you will
have to adjust some settings"+chr(13)+"Check manual Chapter:
'INSTALLATION'",48+16, "At your Service")
else
messagebox("Creating shortcut(s) failed"+chr(13)+"You will have to do this
yourself"+chr(13)+"See manual for Installation",48+16, "At your Service")
endif
</vfp_code>

You may also want to read the following article:
SAMPLE: VFPSCUT.EXE Creates Desktop Shortcut to a VFP Application
http://support.microsoft.com/default.aspx?scid=238553
--
Eric den Doop
www.foxite.com - The Home Of The Visual FoxPro Experts - Powered By VFP8



Re: OT: Creating a .lnk file by John

John
Mon Nov 24 17:28:53 CST 2003

Thanks, Eric! Looks like the thing I needed.

- John

"Eric den Doop" <ericdendoop@xspamblockxfoxite.com> wrote in message
news:eGEIy$tsDHA.3468@TK2MSFTNGP11.phx.gbl...
> Hello, John!
> You wrote on Mon, 24 Nov 2003 16:04:26 -0700:
>
> JS> Sorry, this is tangentally VFP related at best. I'm trying to figure
> JS> out how to programatically drop a shortcut to a vfp executable into
the
> JS> startup programs. The format of such a file seems to escape me, but
> JS> looks more like a table header than a text file. Has anyone done
this?
>
> I found this code in my archives:
> <vfp_code>
> LOCAL lcExecutable, lcShortLNK, lcDesktopFolder
> LOCAL Array laShortCutInfo[2,2]
>
> laShortcutInfo[1,1] = "MyFirstExe.exe"
> laShortcutInfo[1,2] = "MyFirstExe.lnk"
> laShortcutInfo[2,1] = "MySecondExe.exe"
> laShortcutInfo[2,2] = "MySecondExe.lnk"
> oShell = create("wscript.shell")
>
> if type('oShell') = "O" and not isnull(oShell)
> lcDesktopFolder= addbs(oShell.SpecialFolders("desktop"))
> for lnI = 1 to alen( laShortcutInfo,1)
> lcExecutable = laShortcutInfo[lnI,1]
> lcShortLNK = laShortcutInfo[lnI,2]
>
> if file( (lcExecutable) )
> oShortCut = oShell.CreateShortcut(
> addbs(lcDesktopfolder)+lcShortLNK)
>
> With oShortcut
> .Targetpath= addbs(fullpath( curdir()))+lcExecutable
> .WorkingDirectory= addbs(fullpath( curdir()))
> .WindowStyle = 2
> .save()
> endwith
> endif
> endfor
> messagebox("Shortcut(s) created on your desktop"+chr(13)+"maybe you will
> have to adjust some settings"+chr(13)+"Check manual Chapter:
> 'INSTALLATION'",48+16, "At your Service")
> else
> messagebox("Creating shortcut(s) failed"+chr(13)+"You will have to do this
> yourself"+chr(13)+"See manual for Installation",48+16, "At your Service")
> endif
> </vfp_code>
>
> You may also want to read the following article:
> SAMPLE: VFPSCUT.EXE Creates Desktop Shortcut to a VFP Application
> http://support.microsoft.com/default.aspx?scid=238553
> --
> Eric den Doop
> www.foxite.com - The Home Of The Visual FoxPro Experts - Powered By VFP8
>
>