I'm trying to create a Windows shortcut in Harbour for accessing a URL with my browser.
Has anyone had success doing this?
Thanks in advance for any assistance.
Create shortcut for accessing URL
- don lowenstein
- Posts: 201
- Joined: Mon Oct 17, 2005 9:09 pm
- Been thanked: 3 times
- Contact:
- Antonio Linares
- Site Admin
- Posts: 42548
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 78 times
- Contact:
Re: Create shortcut for accessing URL
Dear Don,
Not sure if you mean this:
or maybe this:
Not sure if you mean this:
Code: Select all | Expand
PROCEDURE CreateURLShortcut(cFileName, cURL)
LOCAL hFile
// Ensure the filename ends with .url
IF AT(".url", LOWER(cFileName)) == 0
cFileName += ".url"
ENDIF
// Create and write to the file
hFile := FCreate(cFileName)
IF hFile != -1
FWrite(hFile, "[InternetShortcut]" + Chr(13) + Chr(10))
FWrite(hFile, "URL=" + cURL + Chr(13) + Chr(10))
FClose(hFile)
ELSE
? "Error creating file:", cFileName
ENDIF
RETURN
// Usage:
CreateURLShortcut("MyWebShortcut.url", "https://www.example.com")
Code: Select all | Expand
PROCEDURE CreateLNKShortcut(cLnkPath, cURL)
LOCAL oShell, oShortcut
// Initialize COM (if not already done)
IF !Empty(GetActiveObject("WScript.Shell"))
oShell := CreateObject("WScript.Shell")
ELSE
? "COM initialization failed."
RETURN
ENDIF
// Create the shortcut
oShortcut := oShell:CreateShortcut(cLnkPath)
oShortcut:TargetPath := "rundll32.exe"
oShortcut:Arguments := "url.dll,FileProtocolHandler " + cURL
oShortcut:Save()
RETURN
// Usage:
CreateLNKShortcut("MyWebShortcut.lnk", "https://www.example.com")
- leandro
- Posts: 1752
- Joined: Wed Oct 26, 2005 2:49 pm
- Location: Colombia
- Has thanked: 38 times
- Been thanked: 10 times
- Contact:
Re: Create shortcut for accessing URL
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com
[ Turbo Incremental Link64 6.98 Embarcadero 7.70 ] [ FiveWin 24.09 ] [ xHarbour 64 bits) ]
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com
[ Turbo Incremental Link64 6.98 Embarcadero 7.70 ] [ FiveWin 24.09 ] [ xHarbour 64 bits) ]
- don lowenstein
- Posts: 201
- Joined: Mon Oct 17, 2005 9:09 pm
- Been thanked: 3 times
- Contact:
Re: Create shortcut for accessing URL
Thanks for the suggestions.
I'll test them on Monday.
Antonio, it's good to hear from you. I hope all is well with you and yours.
Don
I'll test them on Monday.
Antonio, it's good to hear from you. I hope all is well with you and yours.
Don
Don Lowenstein
www.laapc.com
www.laapc.com
- don lowenstein
- Posts: 201
- Joined: Mon Oct 17, 2005 9:09 pm
- Been thanked: 3 times
- Contact:
Re: Create shortcut for accessing URL
I noticed that all three of us on this thread joined the FiveTech forum in October 2005.
That's a testament to how good the Fivewin libraries and community are.
I feel privileged to be part of it.
Sincerely, Don
That's a testament to how good the Fivewin libraries and community are.
I feel privileged to be part of it.
Sincerely, Don
Don Lowenstein
www.laapc.com
www.laapc.com
- don lowenstein
- Posts: 201
- Joined: Mon Oct 17, 2005 9:09 pm
- Been thanked: 3 times
- Contact:
Re: Create shortcut for accessing URL
PROCEDURE CreateURLShortcut(cFileName, cURL)
This worked perfectly - Thanks.
This worked perfectly - Thanks.
Don Lowenstein
www.laapc.com
www.laapc.com