|
-
Dec 11th, 2001, 04:56 AM
#1
Thread Starter
New Member
Create Shortcuts - not resolved but answered, cheers
Hi folks,
Currently I am using the fCreateShellLink API call to create a number of shortcuts - however I am wondering if there are any other APIs which can be used to create shortcuts which are in the 'standard' libraries (e.g. Kernel32 etc).
Does anyone know of any other APIs that can be used to create shortcuts??
Ta in advance.
Last edited by AidanG; Dec 11th, 2001 at 09:31 AM.
-
Dec 11th, 2001, 08:35 AM
#2
I believe that fCreateShellLink is the only API that is used for shortcuts. At least, this is the only API I've ever used, personally, and the only one I've ever seen in the numerous examples of creating shortcuts that are available on the various VB websites. Quite frankly, it would be nice if there were something that could be used out of a more standard library like, as you suggest, the Kernel.
-
Dec 11th, 2001, 02:07 PM
#3
Lively Member
id like to think there is ... because not everyone has that library.. yet they can still make shortcuts
-
Dec 12th, 2001, 11:11 AM
#4
Hyperactive Member
I know it's not using API to the deepest extend but
how about this one:
VB Code:
Private Sub CreateDesktopIcon()
Dim objShortcut As Object
Dim objWshShell As IWshShell_Class
Set objWshShell = New IWshShell_Class
Set objShortcut = objWshShell.CreateShortcut(GetDesktopFolderPath(Me.hWnd) & "\" & YourShortcut & ".lnk")
objShortcut.TargetPath = YourPath
objShortcut.Arguments = "/" & YourArguments
objShortcut.WorkingDirectory = YourWDir
objShortcut.IconLocation = YourIconfile
objShortcut.Save
DoEvents
Set objWshShell = Nothing
Set objShortcut = Nothing
End Sub
and to get the desktop:
VB Code:
Private Declare Function SHGetSpecialFolderLocation Lib "shell32" (ByVal hwndOwner As Long, ByVal nFolder As Integer, ppidl As Long) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32" _
Alias "SHGetPathFromIDListA" (ByVal pIdl As Long, ByVal szPath _
As String) As Long
Private Const MAX_PATH = 260
Private Function GetDesktopFolderPath(ByVal pHwnd As Long) As String
Dim lReturn&
Dim lPidl&
Dim strPath$
strPath$ = Space(MAX_PATH)
lReturn& = SHGetSpecialFolderLocation(pHwnd, 0, lPidl)
' Get lPidl& for this Id...
If lReturn = 0 Then
lReturn = SHGetPathFromIDList(lPidl, strPath)
' Get Path from Item Id List
If lReturn = 1 Then 'If successeful
GetDesktopFolderPath = Left(strPath$, _
InStr(strPath$, vbNullChar) - 1)
End If
End If
End Function
Last edited by mvrp350; Dec 12th, 2001 at 11:15 AM.
-
Dec 13th, 2001, 01:53 PM
#5
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|