M
Michaelzhao
Unregistered / Unconfirmed
GUEST, unregistred user!
本人不会vc程序,需要将一vc程序转换成delphi程序,以下是部分程序,请问如何转换,
拜托了,如需要全部程序,可留下qq,本人qq:56306306
DllImport short Inithxms(char*,HWND);
DllImport int MakeAndSendData(BYTE*,BYTE,short,short,void*);
DllImport short StartPDAMenu(char* FileName,int RecordNum);
DllImport bool AddMenu(PREMOTEMENU pMenu);
DllImport void ClosePDAMenu();
DllImport short StartPDATeste(char* FileName,int RecordNum);
DllImport bool AddTeste(PREMOTETASTE pTeste);
DllImport void ClosePDATeste();
DllImport bool UpdateActive(bool isActive);
DllImport void CloseCom();
DllImport int hxmsOrder(BYTE* pbuf,PTASKUSER pTask);
DllImport bool AddMenuLb(char *chLbName,unsigned char lbid,unsigned char Type);
DllImport void ClosePDAMenuLb();
DllImport short StartPDAMenuLb(char* FileName,int RecordNum);
typedef struct tagTASKINFO {
unsigned short tiTableNumber;
unsigned short tiFoodID;
int tiFoodQuanlity;
int tiFoodPrice;
unsigned short tiIndex;
unsigned short tiWorkID;
unsigned char tiTaste[8];
unsigned int tiStatus;
}TASKITEM, *PTASKITEM;
PREMOTETASTE p;
CPtrList pNoteList;
COleDateTime UpdateTime;
int nCount =0;
// nCount=m_pDb->GetUpdateNote(UpdateTime,pNoteList);
POSITION pos = pNoteList.GetHeadPosition();
StartPDATeste(".//Teste.dbv",nCount);
while ( pos != NULL)
{
POSITION prepos = pos;
p = (PREMOTETASTE)pNoteList.GetNext(pos);
if(p->Operation==1)
AddTeste(p);
free(p);
pNoteList.RemoveAt(prepos);
}
ClosePDATeste();
int CBHCY_SERDlg::TranslateData(BYTE *rbuf, int len)
{
int nDataLen = 0;
short ErrorCode = 0;
PWG_HEADPDA pwg_head;
PDATAERR pde;
unsigned char err_buf[SIZE_ERR],total=0;
CString str, strTmp;
CTime t = CTime::GetCurrentTime();
int i=0;
memset(err_buf, 0, SIZE_ERR);
//memcpy(buf, rbuf, len);
pwg_head = (PWG_HEADPDA)rbuf;
pde = (PDATAERR)err_buf;
for(i=0;i <16;i++)
total+=rbuf;
if(total!=pwg_head->totalhead)
return 1;
total=0;
for(i=18;i <ntohs(pwg_head->DataLen);i++)
total+=rbuf;
if(total!=pwg_head->totaldata)
return 1;//较验错误,不处理,直接返回
switch ( pwg_head->CommandType )
{
case CmdID_Login:
{
PLONGPARAMETER pml;
pml = (PLONGPARAMETER)(rbuf + SIZE_HEADPDA);
strTmp.Format("登录命令用户[%d]%s",ntohs(pml->lpAccount),pml->lpPasswd);
Addmessage(strTmp);
pde->errCode=htons(ERR_LOGIN_OK);
pde->retCount=0;
::MakeAndSendData(pwg_head->HardID,CmdID_Error,1,sizeof(DATAERR),err_buf);
}
break;
拜托了,如需要全部程序,可留下qq,本人qq:56306306
DllImport short Inithxms(char*,HWND);
DllImport int MakeAndSendData(BYTE*,BYTE,short,short,void*);
DllImport short StartPDAMenu(char* FileName,int RecordNum);
DllImport bool AddMenu(PREMOTEMENU pMenu);
DllImport void ClosePDAMenu();
DllImport short StartPDATeste(char* FileName,int RecordNum);
DllImport bool AddTeste(PREMOTETASTE pTeste);
DllImport void ClosePDATeste();
DllImport bool UpdateActive(bool isActive);
DllImport void CloseCom();
DllImport int hxmsOrder(BYTE* pbuf,PTASKUSER pTask);
DllImport bool AddMenuLb(char *chLbName,unsigned char lbid,unsigned char Type);
DllImport void ClosePDAMenuLb();
DllImport short StartPDAMenuLb(char* FileName,int RecordNum);
typedef struct tagTASKINFO {
unsigned short tiTableNumber;
unsigned short tiFoodID;
int tiFoodQuanlity;
int tiFoodPrice;
unsigned short tiIndex;
unsigned short tiWorkID;
unsigned char tiTaste[8];
unsigned int tiStatus;
}TASKITEM, *PTASKITEM;
PREMOTETASTE p;
CPtrList pNoteList;
COleDateTime UpdateTime;
int nCount =0;
// nCount=m_pDb->GetUpdateNote(UpdateTime,pNoteList);
POSITION pos = pNoteList.GetHeadPosition();
StartPDATeste(".//Teste.dbv",nCount);
while ( pos != NULL)
{
POSITION prepos = pos;
p = (PREMOTETASTE)pNoteList.GetNext(pos);
if(p->Operation==1)
AddTeste(p);
free(p);
pNoteList.RemoveAt(prepos);
}
ClosePDATeste();
int CBHCY_SERDlg::TranslateData(BYTE *rbuf, int len)
{
int nDataLen = 0;
short ErrorCode = 0;
PWG_HEADPDA pwg_head;
PDATAERR pde;
unsigned char err_buf[SIZE_ERR],total=0;
CString str, strTmp;
CTime t = CTime::GetCurrentTime();
int i=0;
memset(err_buf, 0, SIZE_ERR);
//memcpy(buf, rbuf, len);
pwg_head = (PWG_HEADPDA)rbuf;
pde = (PDATAERR)err_buf;
for(i=0;i <16;i++)
total+=rbuf;
if(total!=pwg_head->totalhead)
return 1;
total=0;
for(i=18;i <ntohs(pwg_head->DataLen);i++)
total+=rbuf;
if(total!=pwg_head->totaldata)
return 1;//较验错误,不处理,直接返回
switch ( pwg_head->CommandType )
{
case CmdID_Login:
{
PLONGPARAMETER pml;
pml = (PLONGPARAMETER)(rbuf + SIZE_HEADPDA);
strTmp.Format("登录命令用户[%d]%s",ntohs(pml->lpAccount),pml->lpPasswd);
Addmessage(strTmp);
pde->errCode=htons(ERR_LOGIN_OK);
pde->retCount=0;
::MakeAndSendData(pwg_head->HardID,CmdID_Error,1,sizeof(DATAERR),err_buf);
}
break;