您的位置:程序门 -> vb ->



各位大大,急问一个win api的问题


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


各位大大,急问一个win api的问题[已结贴,结贴人:xue123456144]
发表于:2008-01-21 10:45:53 楼主
  各位大大,急问一个win   api的问题:
    public   declare   function   shfileexists   lib   "shell32"   alias   "#45"   (byval   szpath   as   string)   as   long
                xmlpath   =   application.startuppath   +   "\connectconfig.xml"

                        dim   a   as   string
                        a   =   str$(shfileexists(xmlpath))
得到的值怎么是8976496028190507008啊,不是只有0或1的吗?
发表于:2008-01-21 10:55:011楼 得分:0
  str$改为str
发表于:2008-01-21 10:57:122楼 得分:0
返回值0是失败的,成功的是非零,并不是1
发表于:2008-01-21 10:57:283楼 得分:0
private   declare   function   shfileexists   lib   "shell32"   alias   "#45"   (byval   szpath   as   string)   as   long
private   sub   command1_click()
        msgbox   shfileexists(strconv("c:\boot.ini",   vbunicode))
end   sub
发表于:2008-01-21 11:13:554楼 得分:0
phenlit   大大:不管成功失败都是得到8976496028190507008阿
chenhui530   大大:没有vbunicode啊,strconv得第二个参数是枚举的阿
发表于:2008-01-21 11:15:285楼 得分:0
shfileexists(strconv("c:\boot.ini",       64))  
 
发表于:2008-01-21 11:29:206楼 得分:0
chenhui530       大大:不行,提示strconv的第二个参数conversion无效
发表于:2008-01-21 11:30:297楼 得分:0
vb.net有没有别的办法判断一个文件是否存在阿?
发表于:2008-01-21 11:39:348楼 得分:0
直接dir

if   dir("c:\123.txt")=""   then
        msgbox   "文件不存在"
else
        msgbox   "文件存在"
end   if
发表于:2008-01-21 12:04:209楼 得分:10
这个api实在有点。。。。。。。。。

换一个吧,用这个好了,不会出问题
vbscript code
private declare function pathfileexists lib "shlwapi.dll" alias "pathfileexistsa" (byval szpath as string) as long
发表于:2008-01-21 12:30:2710楼 得分:10
那还不如用findfirstfile
发表于:2008-01-21 13:03:4511楼 得分:0
谢谢两位大大,先用dir的通过了,作业要交,来不及用其他的了,非常感谢


快速检索

最新资讯
热门点击