注册 登录
编程论坛 PowerBuilder

pb调用char* 类型的API报错

pb2018 发布于 2018-08-24 22:21, 3568 次点击
参    数:iDeviceIndex - 设备序号(从0开始)
            ucImgBuf     - 接收图像数据缓存指针
            nTimeOut     - 超时时间,单位:毫秒,如果nTimeOut=0,则表示无限时等待
            iFlagLeave   - 是否等待手指离开,0-否,1-是
    返    回:  0   - 成功
            其他 - 失败   
函数原型:
int WINAPI mxGetImage(int iDeviceIndex,unsigned char* imageBuf,long nTimeOut=0,int iFlagLeave=1);

在pb9中函数声明为:Function int mxGetImage(int iDeviceIndex, ref string imagebuf, Long nTimeOut, int iFlagLeave) library "mxCapacitiveDriver.dll"

以下是调用方法
Integer li_value
Int li_DevIndex=0
String ls_imagebff, ls_msg,

ls_imagebff = Space(255)
li_value = mxGetImage(li_DevIndex, ls_imagebff,0,1)
但是在调用mxGetImage函数是PB报错。错误如下:Sybase powerbuilder已停止工作,关闭程序或调试程序
2 回复
#2
pb20182018-08-25 00:05
已解决,是分配的空间不足
#3
Bc_Newboy2021-08-02 20:04
指针用ref string,学习了
1