将包含有Null结尾的字符串转换为VB字符串
在VB编程调用WindowsAPI函数时,经常会碰到以Null结尾的字符串,下面是一段将Null结尾字符串转换到VB字符串的函数:
PublicFunctionLPSTRToVBString$(ByVals$)
Dimnullpos&
nullpos&=InStr(s$,Chr$(0))
Ifnullpos>0Then
LPSTRToVBString=Left$(s$,nullpos-1)
Else
LPSTRToVBString=""
EndIf
EndFunction->
PublicFunctionLPSTRToVBString$(ByVals$)
Dimnullpos&
nullpos&=InStr(s$,Chr$(0))
Ifnullpos>0Then
LPSTRToVBString=Left$(s$,nullpos-1)
Else
LPSTRToVBString=""
EndIf
EndFunction->
- 上一篇:VB中如何实现文本查找功能
- 下一篇:如何取得计算机的所有字型
精彩图集
精彩文章