Correct IShellLinkA is not included in the coclass by default; but there is no different default implementation, so you could create a ShellLinkW object but set it to IShellLinkA if you needed to for some reason. CLSID_ShellLink - the ShellLinkW object - actually covers them both; I should have just called ShellLink and added A to it...
For full reference, oleexp has:
interface IShellLinkA
interface IShellLinkW
coclass ShellLinkW with IShellLinkW as the only listed interface [but actually supports IShellLinkA as well]-- CLSID_ShellLink
If you're making a link, this supports unicode (in the filename and link name):
Code:
Public Sub CreateLink(sSrc As String, sDest As String)
Dim isl As ShellLinkW
Dim ipf As oleexp.IPersistFile
Set isl = New ShellLinkW
Set ipf = isl
With isl
.SetPath sSrc
.SetShowCmd SW_NORMAL
.Resolve 0, 4
End With
ipf.Save sDest, 0
Set ipf = Nothing
Set isl = Nothing
End Sub
eg CreateLink "C:\d1\test.txt", "C:\d2\test.txt.lnk"
I tested it by picking a file through a dialog.. where d1 contained a file with unicode chars (H❷m❷❸ v.png) and d2 already existed
Code:
Dim si As IShellItem
Dim fod As FileOpenDialog
Dim lp As Long
Dim s1 As String, s2 As String
Set fod = New FileOpenDialog
fod.Show Me.hWnd
fod.GetResult si
si.GetDisplayName SIGDN_DESKTOPABSOLUTEPARSING, lp
s1 = LPWSTRtoStr(lp)
s2 = Replace$(s1, "d1", "d2") & ".lnk"
'MessageBoxW Me.hWnd, StrPtr(s1 & vbCrLf & s2), StrPtr(App.Title), 0& 'if you want to confirm names and paths
CreateLink s1, s2