[u]Moderator Notes[/u] (Pablo César) wrote:Topic moved from Forum en Español.
Create desktop shortcut
Moderator: Rathinagiri
Create desktop shortcut
Sample to create desktop shortcut
BPD
Convert Dream into Reality through HMG
Convert Dream into Reality through HMG
- esgici
- Posts: 4543
- Joined: Wed Jul 30, 2008 9:17 pm
- DBs Used: DBF
- Location: iskenderun / Turkiye
- Contact:
Re: Create desktop shortcut
Hi Davebpd2000 wrote:Sample to create desktop shortcut
Thank you, nice and useful share
Regards
Viva INTERNATIONAL HMG
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: Create desktop shortcut
Fantastic!
Can we have a User Defined Function for the next version HFCL?
Can we have a User Defined Function for the next version HFCL?
Code: Select all
*------------------------------------------------------------------------------*
FUNCTION CreateDesktopShortcut( cTarget, cTitle, cDescription, lFile )
*------------------------------------------------------------------------------*
default lFile := .t.
local WshShell := CreateObject("WScript.Shell")
local DesktopFolder := WshShell:SpecialFolders("Desktop")
local lSuccess := .f.
do case
case lFile
FileShortcut := WshShell:CreateShortcut(DesktopFolder + "\" + cTitle + ".lnk" )
FileShortcut:TargetPath := cTarget
FileShortcut:Description := cDescription
FileShortcut:WorkingDirectory := DesktopFolder
FileShortcut:Save()
lSuccess := .t.
otherwise
URLShortcut := WshShell:CreateShortcut(DesktopFolder + "\" + cTitle + ".url" )
URLShortcut:TargetPath := cTarget
URLShortcut:Save()
lSuccess := .t.
endcase
WshShell := Nil
RETURN lSuccess
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
- esgici
- Posts: 4543
- Joined: Wed Jul 30, 2008 9:17 pm
- DBs Used: DBF
- Location: iskenderun / Turkiye
- Contact:
Re: Create desktop shortcut
It will be nice and usefulrathinagiri wrote:Can we have a User Defined Function for the next version HFCL?
Does will be more useful two separate function instead of one :
Code: Select all
FUNCTION DTopShCutFil( cTarget, cTitle, cDescription )
LOCAL lSuccess := .F.
IF FILE( cTarget )
...
lSuccess := FILE( cTarget + ".LNK" )
ENDIF
RETURN lSuccess
FUNCTION DTopShCutURL( cTarget, cTitle, cDescription )
LOCAL lSuccess := .F.
IF IsURL( cTarget ) // I don't know how will be this IsURL() :(
...
lSuccess := FILE( cTarget + ".URL" )
ENDIF
RETURN lSuccess
Viva INTERNATIONAL HMG
Re: Create desktop shortcut
Addition to HFCL will be very useful to HMG usersrathinagiri wrote:Fantastic!
Can we have a User Defined Function for the next version HFCL?
BPD
Convert Dream into Reality through HMG
Convert Dream into Reality through HMG
Re: Create desktop shortcut
Very fine functions!
But, if I can ask, please, do not shorten the names of these function - old 10-char long names are the past!
But, if I can ask, please, do not shorten the names of these function - old 10-char long names are the past!
- esgici
- Posts: 4543
- Joined: Wed Jul 30, 2008 9:17 pm
- DBs Used: DBF
- Location: iskenderun / Turkiye
- Contact:
Re: Create desktop shortcut
Hi Marek,mol wrote:old 10-char long names are the past!
You are right
Old men doesn't forget easly their old habits
By the way;
Code: Select all
lSuccess := FILE( cTarget + ".LNK" )
...
lSuccess := FILE( cTarget + ".URL" )
Please supply correct file name instead of cTarget .
Regards
Viva INTERNATIONAL HMG
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: Create desktop shortcut
Super cool Esgici.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
Re: Create desktop shortcut
New example with shortcut remove function from desktop
- Attachments
-
- LinkCreate.rar
- (758 Bytes) Downloaded 426 times
Last edited by bpd2000 on Fri Nov 02, 2012 3:23 pm, edited 1 time in total.
BPD
Convert Dream into Reality through HMG
Convert Dream into Reality through HMG