标题:api函数之getwindowsdirectory结果赋给text1.text出错,
只看楼主
a414715440
Rank: 2
等 级:论坛游民
帖 子:37
专家分:26
注 册:2011-8-28
结帖率:100%
 问题点数:0 回复次数:4 
api函数之getwindowsdirectory结果赋给text1.text出错,
Private Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
---------------------------------
Private Sub Command1_Click()
Dim sBuffer,a As String
     
      sBuffer = Space(255)
     a=GetWindowsDirectory(sBuffer, 255)
     text1.text=a
      
End Sub
 为什么我一运行,出错了,vB整个程序都关掉了,擦,,这是什么意思呢,
搜索更多相关主题的帖子: Space 
2011-09-29 14:46
bczgvip
Rank: 14Rank: 14Rank: 14Rank: 14
等 级:贵宾
威 望:66
帖 子:1310
专家分:5312
注 册:2009-2-26
得分:0 
Dim sBuffer As String,a As String
2011-09-29 14:54
a414715440
Rank: 2
等 级:论坛游民
帖 子:37
专家分:26
注 册:2011-8-28
得分:0 
回复 2楼 bczgvip
经调试, text1.text=10
 这是神马情况呢,
2011-09-29 15:13
bczgvip
Rank: 14Rank: 14Rank: 14Rank: 14
等 级:贵宾
威 望:66
帖 子:1310
专家分:5312
注 册:2009-2-26
得分:0 
Private Sub Command1_Click()
Dim sBuffer as string,a As long
     
      sBuffer = Space(255)
     a=GetWindowsDirectory(sBuffer, 255)
     text1.text= left$(sbuffer,instr(1,sbuffer,vbnullchar)-1)
      
End Sub
2011-09-29 16:23
a414715440
Rank: 2
等 级:论坛游民
帖 子:37
专家分:26
注 册:2011-8-28
得分:0 
回复 4楼 bczgvip
其实不用那么麻烦,我最后试出来了,直接text1.text=sbuffer就行了,汗死
2011-09-29 17:37



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-351284-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.529082 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved