当前位置: 代码迷 >> PB >> pb11调用API函数GetSystemDirectory返回乱码,是不是bug?解决方法
  详细解决方案

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

热度:94   发布时间:2016-04-29 08:39:15.0
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 
  相关解决方案