PB9.0调用VS2010C#编写的DLL,DLL也注册成功了,但是调用报错 -3,求高手出手
1.编写好的DLL在VS2010中正常调用,拿到PB开发环境下,也注册成功,注册表没也有,但是使用PB调用的时候,都报错,提示 -3(代码中flag 值返回-3),PB代码如下:
string messages
string str_pth
string str_bh
string str_mc
string str_dw
string str_zy
string str_sj
string str_fxxm
string str_txm
int flag
long my_return
str_pth='C:\\a\\PrintLable.btw' //打印文件路径
str_bh='AS66666'
str_mc='ddd'
str_dw='FFFF'
str_zy='wer'
str_sj='2018-01-01 12:10:10'
str_fxxm='www-dd-334-dfs-123'
str_txm='AS66666'
try
OleObject Oleb
Oleb = Create OLEObject
flag = Oleb.ConnectToNewObject("Class_Print.PrintLable") //Class_Print C#中命名空间(namespace) PrintLable是打印类
if flag <>0 then
MessageBox("提示",flag)
return
end if
messages =Oleb.PrintTrayLabel(str_bh,str_mc ,str_dw,str_zy,str_sj,str_fxxm,str_txm)
MessageBox("提示",messages)
catch (OLERuntimeError ex)
messagebox('OLE错误',ex.getmessage())
//断开OLE连接
Oleb.DisConnectObject()
Destroy Oleb
return
end try