API之怪现象,高分,在线!!!!

bigsea791121 2002-12-30 10:09:03
Dim Buffer As String, Ret As Long
'create a buffer
Buffer = Space(255)
'copy the current directory to the buffer and append 'myfile.ext'
Ret = GetFullPathName("sale.bak", 255, Buffer, "")
'remove the unnecessary chr$(0)'s
Buffer = Left(Buffer, Ret)
'show the result
MsgBox Buffer


API定义:
Public Declare Function GetFullPathName Lib "kernel32" Alias "GetFullPathNameA" (ByVal lpFileName As String, ByVal nBufferLength As Long, ByVal lpBuffer As String, ByVal lpFilePart As String) As Long


出现提示框:c:\program files\microsoft visual studio\vb98\sale.bak


问题:不管sale.bak在哪个盘,但提示框的信息恒定不变,事实上sale.bak根本不在提示框显示的路径
...全文
14 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
holydiablo 2002-12-31
  • 打赏
  • 举报
回复
right
搜索文件得一个一个来
zyl910 2002-12-30
  • 打赏
  • 举报
回复
GetFullPathName只是得到当前目录下的文件名

而不是搜索文件!

1,486

社区成员

发帖
与我相关
我的任务
社区描述
VB API
社区管理员
  • API
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧