Dim cShellLink As ShellLinkA ' An explorer IShellLink instance
Dim cPersistFile As IPersistFile ' An explorer IPersistFile instance
'---------------------------------------------------------------
If (Len(LnkFile) = 0) Then Exit Function ' Validate min. input requirements.
Set cShellLink = New ShellLinkA ' Create new IShellLink interface
Set cPersistFile = cShellLink ' Implement cShellLink's IPersistFile interface
' Load Shortcut file...(must do this UNICODE hack!)
On Error GoTo ErrHandler
cPersistFile.Load StrConv(我传过来的快捷方式文件名, vbUnicode), STGM_DIRECT
'上面这句就是出错的地方 With cShellLink
ExeFile = Space$(MAX_PATH)
.GetPath ExeFile, MAX_PATH, fd, SLGP_UNCPRIORITY
................
上面的代码哈,就是只要读倒带有"西"字符时就会出现"自动化错误",因为我在读取大话西游戏的快捷方式时出错的,
然后我看了delphi和VC,他们在执行cPersistFile.Load 之前先用下面的API转换过,但我不知道下面的API是管什么用的
Public Declare Function MultiByteToWideChar Lib "kernel32" (ByVal CodePage As Long, ByVal dwFlags As Long, ByVal lpMultiByteStr As String, ByVal cchMultiByte As Long, ByVal lpWideCharStr As String, ByVal cchWideChar As Long) As Long
Dim cPersistFile As IPersistFile ' An explorer IPersistFile instance
'---------------------------------------------------------------
If (Len(LnkFile) = 0) Then Exit Function ' Validate min. input requirements.
Set cShellLink = New ShellLinkA ' Create new IShellLink interface
Set cPersistFile = cShellLink ' Implement cShellLink's IPersistFile interface
' Load Shortcut file...(must do this UNICODE hack!)
On Error GoTo ErrHandler
cPersistFile.Load StrConv(我传过来的快捷方式文件名, vbUnicode), STGM_DIRECT
'上面这句就是出错的地方 With cShellLink
ExeFile = Space$(MAX_PATH)
.GetPath ExeFile, MAX_PATH, fd, SLGP_UNCPRIORITY
................
上面的代码哈,就是只要读倒带有"西"字符时就会出现"自动化错误",因为我在读取大话西游戏的快捷方式时出错的,
然后我看了delphi和VC,他们在执行cPersistFile.Load 之前先用下面的API转换过,但我不知道下面的API是管什么用的
Public Declare Function MultiByteToWideChar Lib "kernel32" (ByVal CodePage As Long, ByVal dwFlags As Long, ByVal lpMultiByteStr As String, ByVal cchMultiByte As Long, ByVal lpWideCharStr As String, ByVal cchWideChar As Long) As Long
解决方案 »
- 视频录像软件
- access数据库数据类型为数字,添加时以0为开头的数字为什么没有了?
- vb 读取 textbox第N行
- 向listbox中添加项,再将listbox中的各项插入数据库!
- 如何用MMControl控件(Multimedia Mci)实现wav的连续播放?
- 请大家帮我分析分析,谢谢
- 请教!
- 在线等待--100分 用fso对象模型查找指定路径下是否存在一个名叫4235668的文件夹
- 请问游戏中的人物是用什么软件写?
- 把MSDN上的文章整理出来发布(免费)算不算侵权?
- 執行階段錯誤430,物件類別不支持AUTOMATION或預期的界面。急!
- 在WORD中录制了宏,请问如何看到VB代码?
D:\常用软件集合\编程\VB60CHS\COMMON\TOOLS\VB\UNSUPPRT\SHELLLNK目录,至少我的是这样