当前位置: 代码迷 >> PB >> ghc 715写卡器dll调用的有关问题
  详细解决方案

ghc 715写卡器dll调用的有关问题

热度:73   发布时间:2016-04-29 08:49:31.0
ghc 715写卡器dll调用的问题
int __stdcall writecard(int comport,int track,char data1[37],char data2[104]);
原型 是这样的 
pb 声明
Function Int writecard(Int port,Int track, ref string data1, ref string data2) Library "ghc715.dll" alias for 'writecard' 
运行报Error.Specified argument type differs from required argument type at runtime in dll function ecrcomm.(invalid stack pointer on return from function call)
错误 

改成了
Function Int writecard(Int port,Int track, ref char data1[37], ref char data2[104]) Library "ghc715.dll" alias for 'writecard' 
Function Int writecard(Int port,Int track, ref blob data1, ref blob data2) Library "ghc715.dll" alias for 'writecard' 

都报一样的错误 ,真不知道该怎么用了

------解决方案--------------------
int __stdcall writecard(int comport,int track,char data1[37],char data2[104]);
原型 是这样的
pb 声明
Function long writecard(long port,long track, ref string data1, ref string data2) Library "ghc715.dll"

他们的int对应的是32位数值,在pb内用long。
另外,他的字符数组,你要注意他的长度。
建议使用一个全局数组,来匹配。
------解决方案--------------------
2.5 Power Builder调用示例
  1.声明:
  Function Int readcard(Int port,Int track,ref string data1,ref string data2,Int model,Int cmto) Library "ghc715.dll"
  Function Int writecard(Int port,Int track,ref string data1,ref string data2,Int model,Int cmto) Library "ghc715.dll"
  2.调用:
  boolean bRead=true
  int nTrack
  int nModel
  int nCmto
  int err
  string s1,s2
  s1=space(200)
  s2=space(200)
  nTrack=integer(sle_track.text)
  err=readcard(1,nTrack,s1,s2,,nModel,nCmto)
  err=writecard(1,nTrack,s1,s2,nModel,nCmto)
------解决方案--------------------
他们的函数原型是这样的,楼主你是从哪里看来是你写的那样的???

C/C++ code
//定义指向DLL库中writecard指针  typedef int (__stdcall *MYFUN2)(int comport,int track,char data1[37],char data2[104],int model,long cmto);  MYFUN2 writecard;
------解决方案--------------------
楼主自己到 北京金诚信齐通科技有限公司 的网站上去看看
http://www.ghc.com.cn/chanpinshuoming/55_3.html
------解决方案--------------------
是不是9之前 之后版本使用有问题啊
------解决方案--------------------
你找他们公司要啊,应该有pb的demo
  相关解决方案