C++有这样的一个函数,在VB中如何定义这个API呢?//向网关提交消息
int CMPP_Submit(
int conn_id,INT64 *msg_id,unsigned char msg_level,
char *service_id,unsigned char msg_format,char *msg_src,
char *fee_type,char *fee_code,char *valid_time,char *at_time,
unsigned char tp_pid,unsigned char tp_udhi,unsigned char fee_usertype,
char *charge_mobile,char *src_mobile,unsigned char user_num,
char *dest_mobiles,char *msg,int msg_len, unsigned char need_response);
int CMPP_Submit(
int conn_id,INT64 *msg_id,unsigned char msg_level,
char *service_id,unsigned char msg_format,char *msg_src,
char *fee_type,char *fee_code,char *valid_time,char *at_time,
unsigned char tp_pid,unsigned char tp_udhi,unsigned char fee_usertype,
char *charge_mobile,char *src_mobile,unsigned char user_num,
char *dest_mobiles,char *msg,int msg_len, unsigned char need_response);
解决方案 »
- 求助 关于vb 连接 access的问题。
- 本人初学者,问VB求圆周率的问题
- 得到的这个窗口句柄应该如何用啊?在线等...
- 急问一个初级问题:有关控件的数组传参问题!帮帮我--载线等
- Cooly(☆开心就好 ^o^ ☆) ,lxcc(虫莲), online(龙卷风(学习.NET中...)) 请进
- 在csdn上有很多关于调用路径选择对话框的代码,却没有调用带“新建文件夹”按钮的路径选择对话框,他是不是第三方的东东?到哪里找?
- 如何实现XP风格的窗体
- 如何判断一个text中的内容是数字
- 我想编一VB程序,该程序运行后使另一正在运行的VB程序受它运行结果的影响(比如死掉).但不知两个程序怎样关联?
- 怎样用VB在一个文本文件中插入或删除字符?
- 菜鸟高分求解,公司的ERP软件已经绑定了水晶报表,可以在不开发的情况下定制报表吗,具体如何做?up者有分
- 打包时设置注册码的问题?
declare fucntion CMPP_submit(byval conn_id as long, msg_id as any, byval msg_level as byte, byval service_id as string, ......)
public declare function CMPP_Submit lib "你的库文件名" ( _
byval conn_id as long, byref msg_id as currency,byval msg_level as byte, _
byval service_id as string,byval msg_format as byte,byval msg_src as string, _
byval fee_type as string,byval fee_code as string,byval valid_time as string, _
byval at_time as string,byval tp_pid as byte,byval tp_udhi as byte, _
byval fee_usertype as byte,byval charge_mobile as string,byval src_mobile as string, _
byval user_num as byte,byval dest_mobiles as string,byval msg as string, _
byval msg_len as long, byval need_response as byte) as long凡是声明为 byval xx as string 的,也可以声明成 byref xx() as byte, 尤其是数据中含有值大于 127 的字节时。
我编译成EXE后,执行此方法报内存错误
我编译成EXE后,执行此方法报内存错误
看参数是否对应一致
//向网关提交消息
int CMPP_Submit(
int conn_id,INT64 *msg_id,unsigned char msg_level,
char *service_id,unsigned char msg_format,char *msg_src,
char *fee_type,char *fee_code,char *valid_time,char *at_time,
unsigned char tp_pid,unsigned char tp_udhi,unsigned char fee_usertype,
char *charge_mobile,char *src_mobile,unsigned char user_num,
char *dest_mobiles,char *msg,int msg_len, unsigned char need_response);我在VB中的用了两种方式定义:
Public Declare Function CMPP_Submit Lib "CMPPAPI.dll" (ByVal actId As Long, ByRef msgId As Currency, _
ByVal msg_level As Byte, ByVal service_id As String, ByVal msg_format As Byte, _
ByVal msg_src As String, ByVal fee_type As String, ByVal free_code As String, _
ByVal valid_time As String, ByVal at_time As String, ByVal tp_pid As Byte, _
ByVal tp_udhi As Byte, ByVal fee_usertype As Byte, ByVal charge_mobile As String, _
ByVal src_mobile As String, ByVal user_num As Byte, ByVal dest_mobiles As String, _
ByVal msg As String, ByVal msg_len As Long, ByVal need_response As Byte) As Long'Public Declare Function CMPP_Submit Lib "CMPPAPI.dll" ( _
' ByVal conn_id As Long, ByRef msg_id As Any, ByVal msg_level As Byte, _
' ByRef service_id() As Byte, ByVal msg_format As Byte, ByRef msg_src() As Byte, _
' ByRef fee_type() As Byte, ByRef fee_code() As Byte, ByRef valid_time() As Byte, _
' ByRef at_time() As Byte, ByVal tp_pid As Byte, ByVal tp_udhi As Byte, _
' ByVal fee_usertype As Byte, ByRef charge_mobile() As Byte, ByRef src_mobile() As Byte, _
' ByVal user_num As Byte, ByRef dest_mobiles() As Byte, ByRef msg() As Byte, _
' ByVal msg_len As Long, ByVal need_response As Byte) As Long当调用此函数过程没有报错.但是在接着的代码中就不能进行其他操作如果进行了操作有两种情况:
(两种情况都是在EXE中执行)
1. if result >0 then
s = s & "成功!"
else
s =s & "失败"
报内存错误2.call log("成功")
报错:未设置对象变量或 With block 变量
如果你没有源码,只有一个办法,再用 C 写一个__stdcall DLL 库函数作“二传手”,VB 调用它,它调用目标函数。
http://community.csdn.net/Expert/topic/4126/4126385.xml?temp=.8292505