delphi调用C编写的dll,对应的类型转换有规律可寻么?(100分)

  • 主题发起人 主题发起人 fff2001
  • 开始时间 开始时间
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 &nbsp; -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, //接收手机个数 &lt;100<br> char *dest_mobiles, //接收手机号码,以空格分隔<br> char *msg, //消息内容<br> int &nbsp;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 : &nbsp;端口号 <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, //接收手机个数 &lt;100<br> char *dest_mobiles, //接收手机号码,以空格分隔<br> char *msg, //消息内容<br> int &nbsp;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>&nbsp; &nbsp; &nbsp; &nbsp; _int64 &nbsp;msgID; //消息ID<br>&nbsp; &nbsp; &nbsp; &nbsp; char &nbsp; &nbsp;dest_id[21]; //消息级别<br>&nbsp; &nbsp; &nbsp; &nbsp; char &nbsp; &nbsp;service_id[10]; //业务代码<br>&nbsp; &nbsp; &nbsp; &nbsp; unsigned char tp_pid;<br> unsigned char tp_udhi;<br> unsigned char &nbsp; msgFormat; //消息格式<br>&nbsp; &nbsp; &nbsp; &nbsp; char &nbsp; &nbsp;sourceUser[12]; //发送消息的手机<br>&nbsp; &nbsp; &nbsp; &nbsp; unsigned char &nbsp; reg_deliver; //是否为应答消息,1=yes,0=no<br>&nbsp; &nbsp; &nbsp; &nbsp; unsigned char &nbsp; msgLen; //消息长度<br>&nbsp; &nbsp; &nbsp; &nbsp; char &nbsp; &nbsp;msg[161]; //消息内容<br>}; &nbsp; &nbsp; <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:成功; &nbsp;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>&nbsp; &nbsp; &nbsp; &nbsp; _int64 &nbsp; &nbsp; &nbsp; &nbsp;msgID;<br>&nbsp; &nbsp; &nbsp; &nbsp; char &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;stat[7];<br>&nbsp; &nbsp; &nbsp; &nbsp; char &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;submit_time[10];<br>&nbsp; &nbsp; &nbsp; &nbsp; char &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;done_time[10];<br>&nbsp; &nbsp; &nbsp; &nbsp; char &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;destUser[21];<br>&nbsp; &nbsp; &nbsp; &nbsp; unsigned long &nbsp; 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
 
char char<br>int Integer<br>char * pchar<br>结构 record<br>unsigned char word<br>int64 Int64
 
h文件怎样处理,lib文件呢?是不是可以乎略!
 
叹气!自行解决吧<br>C/C++ Type ObjectPascal Type <br>unsigned short [int] Word <br>[signed] short [int] SmallInt <br>unsigned [int] Cardinal { 3.25 fix } <br>[signed] int Integer <br>UINT LongInt { or Cardinal } <br>WORD Word <br>DWORD LongInt { or Cardinal } <br>unsigned long LongInt { or Cardinal } <br>unsigned long int LongInt { or Cardinal } <br>[signed] long LongInt <br>[signed] long int LongInt <br>char Char <br>signed char ShortInt <br>unsigned char Byte <br>char* PChar <br>LPSTR or PSTR PChar <br>LPWSTR or PWSTR PWideChar { 3.12 fix } <br>void* Pointer <br>BOOL Bool <br>float Single <br>double Double <br>long double Extended <br>&nbsp; <br>LP,NP,PP,P prefix: if first = T then T becomes P else P prefix <br>&nbsp; <br>HANDLE THandle <br>FARPROC TFarProc <br>ATOM TAtom <br>TPOINT TPoint <br>TRECT TRect <br>COLORREF TColorRef <br>OFSTRUCT TOFStruct <br>DEBUGHOOKINFO TDebugHookInfo <br>BITMAP TBitMap <br>RGBTRIPLE TRGBTriple <br>RGBQUAD TRGBQuad <br>BITMAPCOREHEADER TBitmapCoreHeader <br>BITMAPINFOHEADER TBitmapInfoHeader <br>BITMAPINFO TBitmapInfo <br>BITMAPCOREINFO TBitmapCoreInfo <br>BITMAPFILEHEADER TBitmapFileHeader <br>HANDLETABLE THandleTable <br>METARECORD TMetaRecord <br>METAHEADER TMetaHeader <br>METAFILEPICT TMetaFilePict <br>TEXTMETRIC TTextMetric <br>NEWTEXTMETRIC TNewTextMetric <br>LOGBRUSH TLogBrush <br>LOGPEN TLogPen <br>PATTERN TPattern { TLogBrush } <br>PALETTEENTRY TPaletteEntry <br>LOGPALETTE TLogPalette <br>LOGFONT TLogFont <br>ENUMLOGFONT TEnumLogFont <br>PANOSE TPanose <br>KERNINGPAIR TKerningPair <br>OUTLINETEXTMETRIC TOutlineTextMetric <br>FIXED TFixed <br>MAT2 TMat2 <br>GLYPHMETRICS TGlyphMetrics <br>POINTFX TPointFX <br>TTPOLYCURVE TTTPolyCurve <br>TTPOLYGONHEADER TPolygonHeader <br>ABC TABC <br>RASTERIZER_STATUS TRasterizer_Status <br>MOUSEHOOKSTRUCT TMouseHookStruct <br>CBTACTIVATESTRUCT TCBTActivateStruct <br>HARDWAREHOOKSTRUCT THardwareHookStruct <br>EVENTMSG TEventMsg <br>WNDCLASS TWndClass <br>MSG TMsg <br>MINMAXINFO TMinMaxInfo <br>SEGINFO TSegInfo <br>ACCEL TAccel <br>PAINTSTRUCT TPaintStruct <br>CREATESTRUCT TCreateStruct <br>CBT_CREATEWND TCBT_CreateWnd <br>MEASUREITEMSTRUCT TMeasureItemStruct <br>DRAWITEMSTRUCT TDrawItemStruct <br>DELETEITEMSTRUCT TDeleteItemStruct <br>COMPAREITEMSTRUCT TCompareItemStruct <br>WINDOWPOS TWindowPos <br>WINDOWPLACEMENT TWindowPlacement <br>NCCALCSIZE_PARAMS TNCCalcSize_Params <br>SIZE TSize <br>MENUITEMTEMPLATEHEADER TMenuItemTemplateHeader <br>MENUITEMTEMPLATE TMenuItemTemplate <br>DCB TDCB <br>COMSTAT TComStat <br>MDICREATESTRUCT TMDICreateStruct <br>CLIENTCREATESTRUCT TClientCreateStruct <br>MULTIKEYHELP TMultiKeyHelp <br>HELPWININFO THelpWinInfo <br>CTLSTYLE TCtlStyle <br>CTLtype TCtltype <br>CTLINFO TCtlInfo <br>DDEADVISE TDDEAdvise <br>DDEDATA TDDEData <br>DDEPOKE TDDEPoke <br>DDEAACK TDDEAck <br>DEVMODE TDevMode <br>KANJISTRUCT TKanjiStruct <br>
 
我也有个问题,借用一下宝地<br>http://www.delphibbs.com/delphibbs/dispq.asp?lid=1874245<br><br>用vc写的dll中有一个函数<br>bool &nbsp;play(ULONG lPlayer,FILE *file = NULL);<br>我在delphi中调用,这个函数怎么声明,第二个参数该怎么样传?<br><br>为什么我用openfile打开文件时,<br>filehandle := fileopen(strFilename,fmCreate);<br>返回值总是-1?<br><br>系统 win2kpro &nbsp;delphi6 +upd1+upd2<br><br><br>
 
多人接受答案了。
 
后退
顶部