F
fff2001
Unregistered / Unconfirmed
GUEST, unregistred user!
delphi调用C编写的dll,对应的类型转换有规律可寻么?我想调用cmppAPi。<br>头文件如下:<br>#ifndef TSSX_CMPP_H<br>#define TSSX_CMPP_H<br>#pragma pack(1)<br><br>#define ERROR_OK 0<br><br>#define ERROR_SOCKET_CREATE -100<br>#define ERROR_CONNECT -101<br>#define ERROR_SOCKET_WRITE -102<br>#define ERROR_SOCKET_READ -103<br>#define ERROR_ICP_ID -104<br>#define ERROR_AUTH -105<br>#define ERROR_MSG_LEN -106<br>#define ERROR_FEE_CODE -107<br>#define ERROR_SERVICE_ID -108<br>#define ERROR_FLOW_CONTROL -109<br>#define ERROR_SOCKET_CLOSE -110<br><br><br>#define ERROR_INTERNAL -200<br>#define ERROR_UNKNOWN -201<br>#define ERROR_ARGUMENT -202<br><br>struct Query_Res{<br> unsigned long mt_total_msg; //从ICP接收的信息总数<br> unsigned long mt_total_user; //从ICP接收的用户总数<br> unsigned long mt_succ; //成功转发数量<br> unsigned long mt_wait; //待转发数量<br> unsigned long mt_fail; //转发失败数量<br> unsigned long mo_succ; //向ICP成功送达数量<br> unsigned long mo_wait; //向ICP待送达数量<br> unsigned long mo_fail; //向ICP送达失败数量<br>};<br> <br>//与网关建立MT连接<br>int CMPP_Connect(char *gw_ip,short port,char *username,char *passwd);<br><br>//向网关提交消息<br>int CMPP_Submit(int conn_id, //the return value by CMPP_Connect <br> INT64 *msg_id, // message ID<br> unsigned char msg_level, //消息级别<br> char *service_id, //服务代码<br> unsigned char msg_format, //消息格式 0=ASCII 4=bin 8=UCS2 15=GB<br> char *msg_src, //消息来源<br> char *fee_type, //01=免费 02=按条 03=包月 04=封顶 05=SP收费<br> char *fee_code, //资费代码,以分为单位<br> char *valid_time, //存活时间,格式为YYYYMMDDHHMISS<br> char *at_time, //发送时间,格式为YYYYMMDDHHMISS<br> unsigned char tp_pid,<br> unsigned char tp_udhi,<br> unsigned char fee_usertype,<br> char *charge_mobile,<br> char *src_mobile, //源手机号,没有写"0"<br> unsigned char user_num, //接收手机个数 <100<br> char *dest_mobiles, //接收手机号码,以空格分隔<br> char *msg, //消息内容<br> int msg_len, //消息长度<br> unsigned char need_response); //是否需要状态确认,0=no 1=yes<br> <br>//与网关断开连接<br>int CMPP_Disconnect(int conn_id);<br><br>int CMPP_Brief_Submit(char *gw_ip, //网关的IP地址<br> short port, //port : 端口号 <br> char *username, //ICP的名称<br> char *passwd, //ICP的密码<br> INT64 *msg_id, // message ID<br> unsigned char msg_level, //消息级别<br> char *service_id, //服务代码<br> unsigned char msg_format, //消息格式 0=ASCII 4=bin 8=UCS2 15=GB<br> char *msg_src, //消息来源<br> char *fee_type, //01=免费 02=按条 03=包月 04=封顶 05=SP收费<br> char *fee_code, //资费代码,以分为单位<br> char *valid_time, //存活时间,格式为YYYYMMDDHHMISS<br> char *at_time, //发送时间,格式为YYYYMMDDHHMISS<br> unsigned char tp_pid,<br> unsigned char tp_udhi,<br> unsigned char fee_usertype,<br> char *charge_mobile,<br> char *src_mobile, //源手机号,没有写"0"<br> unsigned char user_num, //接收手机个数 <100<br> char *dest_mobiles, //接收手机号码,以空格分隔<br> char *msg, //消息内容<br> int msg_len, //消息长度<br> unsigned char need_response);<br><br>#define QUERY_TOTAL 0<br>#define QUERY_SERVICE 1<br><br>//发送短信状态查询(查询Time属性指定的日期的统计信息)<br>int CMPP_Query(int conn_id,char *date,unsigned char type,char *service,struct Query_Res *p_res);<br><br>struct MO_msg{<br> _int64 msgID; //消息ID<br> char dest_id[21]; //消息级别<br> char service_id[10]; //业务代码<br> unsigned char tp_pid;<br> unsigned char tp_udhi;<br> unsigned char msgFormat; //消息格式<br> char sourceUser[12]; //发送消息的手机<br> unsigned char reg_deliver; //是否为应答消息,1=yes,0=no<br> unsigned char msgLen; //消息长度<br> char msg[161]; //消息内容<br>}; <br><br>// 连接MO网关,与CMPP_Connect类似<br>int CMPP_Connect_MO(char *gw_ip,short port,char *username,char *passwd);<br>//等待MO消息,如果没有MO消息将阻塞,直至MO消息到达或连接被网关关闭<br>int CMPP_Get_MO(int conn_id,struct MO_msg *p_MO);<br><br>struct Cancel_Rep_Msg{<br> unsigned char res; //成功标识(0:成功; 1:失败)<br>};<br><br>//删除短信<br>int CMPP_Cancel(int conn_id,_int64 msg_id,struct Cancel_Rep_Msg *p_Cancel_Rep_Msg);<br><br>struct status_report{<br> _int64 msgID;<br> char stat[7];<br> char submit_time[10];<br> char done_time[10];<br> char destUser[21];<br> unsigned long smsc_seq;<br>};<br><br>int is_status_report(struct MO_msg *p_MO);<br>struct status_report *get_status_report(struct MO_msg *p_MO);<br>int CMPP_Active(int conn_id);<br><br>#pragma pack(8)<br>#endif