首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > PB >

pb11调用API函数GetSystemDirectory返回乱码,是不是bug?解决方法

2012-03-27 
pb11调用API函数GetSystemDirectory返回乱码,是不是bug?声明函数ulongGetSystemDirectoryA(refstringwdir,

pb11调用API函数GetSystemDirectory返回乱码,是不是bug?
声明函数
  ulong GetSystemDirectoryA(ref string wdir, ulong buf) LIBRARY "kernel32.dll"

程序:  
  string sTmp
  ulong max_len
  ulong Length
  max_len=128
  sTmp = space(200)
  Length = GetSystemDirectory(sTmp, max_len)


返回的sTmp是乱码
我试了GetWindowsDirectory也是返回乱码.是不是pb11有bug啊?
我尝试了GetSystemDirectory,也是乱码,几种声明都尝试了,都是返回乱码.


[解决办法]
Function uint GetSystemDirectory(ref string lpBuffer,uint uSize) Library 'kernel32.dll' Alias for 'GetSystemDirectoryA;ansi' 

不要轻易下结论!
PB11要加;ansi
 
[解决办法]
真的会被你雷死.

PB10后PB就用的unicode.
所以用ansi的API函数据得声明成4楼的样子.

别动不动就轻易下结论
[解决办法]

探讨
Function uint GetSystemDirectory(ref string lpBuffer,uint uSize) Library 'kernel32.dll' Alias for 'GetSystemDirectoryA;ansi' 

不要轻易下结论! 
PB11要加;ansi 

热点排行