在VC中函数的声明,及参数的定义如下:extern "C" unsigned __declspec(dllexport) __cdecl SendSMS(void *p_DestNo, void *p_SvcType,
unsigned p_Length, void *p_Content, unsigned char p_TpUid, unsigned char p_TpUdhi,
void *p_ScheduleTime, unsigned short p_ExpireTime, unsigned short p_Times, unsigned short p_Interval,
void *p_ChargeNo);
UINT CUsedllDlg::ThreadProc(void* pData)
{ unsigned p_SPCode = 0, p_Length = 0;
word p_ExpireTime, p_Times, p_Interval;
byte p_TpPid, p_TpUdhi;
char p_DestNo[22], p_SvcType[11], p_Content[400];
char p_ScheduleTime[15], p_ChargeNo[22];
CString tempstr, cs_now;
int i = 0, j = 0, ii = 0, kk = 0, jj = 0;
int retcode = 0;
unsigned char Buffer[4096];
Receive *rec;
p_SPCode = 100;
p_ExpireTime = 1440;
//p_ExpireTime = 5;
p_Times = 1;
p_Interval = 0;
p_TpPid = 0;
p_TpUdhi = 0;
memset(p_SvcType, 0, 11);
memset(p_Content, 0, 400);
memset(p_ScheduleTime, 0, 15);
memset(p_ChargeNo, 0, 22);
memset(p_DestNo, 0, 22);
sprintf(p_DestNo, "%s", m_pThis->m_DestNum);
//strcpy(p_SvcType, "ETOTTEST");
sprintf(p_SvcType, "%s", m_pThis->m_Svr_Type);
sprintf(p_Content, "%s", m_pThis->m_Content);
p_Length = strlen((char*)p_Content);
CTime ct_now = CTime::GetCurrentTime();
cs_now = ct_now.Format("%Y%m%d%H%M%S");
sprintf(m_pthis->m_destnum,"%s",p_destno);
//strcpy(p_ChargeNo, "0");
sprintf(p_ChargeNo, "%s", m_pThis->m_ChargeNum);
m_pThis->m_Flag = 0;
for(i=0; i<m_pThis->m_Count; i++)
{
if(m_pThis->m_Flag) return 0;
int oid = SendSMS(p_DestNo, p_SvcType, p_Length, p_Content, p_TpPid, p_TpUdhi,
cs_now.GetBuffer(cs_now.GetLength()), p_ExpireTime, p_Times, p_Interval, p_ChargeNo);
cs_now.ReleaseBuffer();
tempstr.Format("%d",oid);
m_pThis->m_Oid.SetWindowText(tempstr);
能将上面的代码改写成DELPHI电码
unsigned p_Length, void *p_Content, unsigned char p_TpUid, unsigned char p_TpUdhi,
void *p_ScheduleTime, unsigned short p_ExpireTime, unsigned short p_Times, unsigned short p_Interval,
void *p_ChargeNo);
UINT CUsedllDlg::ThreadProc(void* pData)
{ unsigned p_SPCode = 0, p_Length = 0;
word p_ExpireTime, p_Times, p_Interval;
byte p_TpPid, p_TpUdhi;
char p_DestNo[22], p_SvcType[11], p_Content[400];
char p_ScheduleTime[15], p_ChargeNo[22];
CString tempstr, cs_now;
int i = 0, j = 0, ii = 0, kk = 0, jj = 0;
int retcode = 0;
unsigned char Buffer[4096];
Receive *rec;
p_SPCode = 100;
p_ExpireTime = 1440;
//p_ExpireTime = 5;
p_Times = 1;
p_Interval = 0;
p_TpPid = 0;
p_TpUdhi = 0;
memset(p_SvcType, 0, 11);
memset(p_Content, 0, 400);
memset(p_ScheduleTime, 0, 15);
memset(p_ChargeNo, 0, 22);
memset(p_DestNo, 0, 22);
sprintf(p_DestNo, "%s", m_pThis->m_DestNum);
//strcpy(p_SvcType, "ETOTTEST");
sprintf(p_SvcType, "%s", m_pThis->m_Svr_Type);
sprintf(p_Content, "%s", m_pThis->m_Content);
p_Length = strlen((char*)p_Content);
CTime ct_now = CTime::GetCurrentTime();
cs_now = ct_now.Format("%Y%m%d%H%M%S");
sprintf(m_pthis->m_destnum,"%s",p_destno);
//strcpy(p_ChargeNo, "0");
sprintf(p_ChargeNo, "%s", m_pThis->m_ChargeNum);
m_pThis->m_Flag = 0;
for(i=0; i<m_pThis->m_Count; i++)
{
if(m_pThis->m_Flag) return 0;
int oid = SendSMS(p_DestNo, p_SvcType, p_Length, p_Content, p_TpPid, p_TpUdhi,
cs_now.GetBuffer(cs_now.GetLength()), p_ExpireTime, p_Times, p_Interval, p_ChargeNo);
cs_now.ReleaseBuffer();
tempstr.Format("%d",oid);
m_pThis->m_Oid.SetWindowText(tempstr);
能将上面的代码改写成DELPHI电码
解决方案 »
- Delphi使用SQL Server如何可以不安装SQLServer2000
- 为什么我做了一个client和server用socket连接的,在本机上是正确的,我将client放到网内其它机器上,无法运行client?
- 请问如何用dbExpress联结IBM400小型机上的DB2数据库?
- TTreeView中节点的字体颜色可以独立设定吗?
- 如何让stringgrid指定的行显示与背景不同的颜色?高分回报!
- 大虾帮帮忙,已知另一台机器的管理员密码,如何远程关闭启动该机的一个进程
- 过节了,技术大放送6:利用程序取得Access数据库的密码(当然可以扩展...)。
- 我写了个文档,看的人不少,可怎么没人提意见?
- 请问:能这样使用参数吗?
- 使用delphi写的程序,使用access数据库,ADO方法连接,如何打包?在一个新计算机可以运行?
- 这种SQL语句怎么写???
- 有做过铁路减速顶项目的兄弟吗???有点问题想请教!
不过有几个要点可以告诉你
byte,word再delphi中有定义,你可以简单改一下语法
char p_DestNo[22]-》p_dest_no:array[1..22] of char;
Receive是你自己定义的数据类型把
memset可再delphi中直接用无须改动
sprintf可以该为format函数
strlen返回字符串长度,再delphi中也用意实现吧,呵呵
至于SendSms的调用再pas文件中写类似这样的声明
function SendSms(.....参数): string(返回类型);
safecall; external 'XXXX.dll';
procedure SendSMS(p_DestNo:PChar;p_SvcType:PChar;
p_Length:unsigned;p_Content:PChar;char p_TpUid:unsigned;p_TpUdhi:byte;
p_ScheduleTime:Pchar; p_ExpireTime:word;p_Times:word; p_Interval:word;
p_ChargeNo:Pchar);safecall; external 'XXXX.dll';
4byte数据类型定义为:integer, 1byte数据类型定义为:byte
字符类型定义为:array [1..22] of char;.....
p_SvcType:='hello';//赋初直;
.....
AStream:=TMemoryString.Create;
AStream.Write(p_SvcType,6);//字符类型长度为=实际长度+1
AStream.Write(...,...);
AStream.Write(...,...);
AStream.Position:=0;
ClientSocket1.Socket.SendStream(AStream);
.....