M
mrdingsheng
Unregistered / Unconfirmed
GUEST, unregistred user!
我现在在头文件里定义了以下函数:
typedef int (CALLBACK* CV64SetMsgCallBack)(CV64X0_MSGCALLBACK_TYPE CV64MessageTag);
typedef int (CALLBACK* CV64GetMessage)(unsigned long Message,char *str);
typedef DWORD (*CV64X0_MSGCALLBACK_TYPE)(unsigned long MessageTag);
我现在的程序如下:
unsigned long CALLBACK thisMSGCallBack(unsigned long MessageTag)
{
char tmpArray[100];
if(MessageTag!=0xFFFF)
{
CV64GetMessage(MessageTag,tmpArray);
// pRThis->AddContent(tmpArray,0,1);
SetWindowText(pRThis->Edit5->Handle,tmpArray);
UpdateWindow(pRThis->Edit5->Handle);
}
return 0;
}
问题是:在以上这段程序中,我设断点的话,但是当程序启动的时候却进不来,请问该如何解决?
在下面这段程序中,我在AddMessage("Open USB Success!"这句程序设了断点,但是当单步执行的时候却不执行CV64SetMsgCallBack((CV64X0_MSGCALLBACK_TYPE)thisMSGCallBack);这一句,不知道是怎么回事,请各位大侠帮忙,谢谢!!!!
bool TReaderMainForm::SetCommParameter()
{
int nAdd=StrToInt(Trim(Edit32->Text));
CV_Connection Connection;
Connection=(CV_Connection)GetProcAddress(hdll,"Connection"
TLoginForm *LoginForm;
bool bStatus = false;
LoginForm = new TLoginForm(Application);
try
{
LoginForm->ShowModal();
if (LoginForm->ModalResult == mrOk )
{
FStrCommPort = LoginForm->GetComPort();
FBaudRate = LoginForm->GetBautRate();
FCommModel = LoginForm->GetCommModel();
int status=Connection(7,1,"USB",6000,NULL,nAdd);
if (status==0x00)
{
AddMessage("Open USB Success!"
CV64SetMsgCallBack((CV64X0_MSGCALLBACK_TYPE)thisMSGCallBack);
}
else
{
AddMessage("Open USB Fail!"
}
//this->SetReaderBaudRate(FBaudRate);
//CloseComm();
//if(!OpenComm(FStrCommPort.c_str(),FBaudRate))
//AddMessage("Initial "+FStrCommPort+"
Baud Rate "+IntToStr(FBaudRate)+ "(OK)"
//else
AddMessage("Initial "+FStrCommPort+"
Baud Rate "+IntToStr(FBaudRate)+"(FAILED)"
EtCommPort->Text = FStrCommPort;
EtBaudRate->Text = IntToStr(FBaudRate);
bStatus = true;
}
else
{
LoginForm->Close();
bStatus = false;
}
}
__finally
{
delete LoginForm;
}
return bStatus;
}
typedef int (CALLBACK* CV64SetMsgCallBack)(CV64X0_MSGCALLBACK_TYPE CV64MessageTag);
typedef int (CALLBACK* CV64GetMessage)(unsigned long Message,char *str);
typedef DWORD (*CV64X0_MSGCALLBACK_TYPE)(unsigned long MessageTag);
我现在的程序如下:
unsigned long CALLBACK thisMSGCallBack(unsigned long MessageTag)
{
char tmpArray[100];
if(MessageTag!=0xFFFF)
{
CV64GetMessage(MessageTag,tmpArray);
// pRThis->AddContent(tmpArray,0,1);
SetWindowText(pRThis->Edit5->Handle,tmpArray);
UpdateWindow(pRThis->Edit5->Handle);
}
return 0;
}
问题是:在以上这段程序中,我设断点的话,但是当程序启动的时候却进不来,请问该如何解决?
在下面这段程序中,我在AddMessage("Open USB Success!"这句程序设了断点,但是当单步执行的时候却不执行CV64SetMsgCallBack((CV64X0_MSGCALLBACK_TYPE)thisMSGCallBack);这一句,不知道是怎么回事,请各位大侠帮忙,谢谢!!!!
bool TReaderMainForm::SetCommParameter()
{
int nAdd=StrToInt(Trim(Edit32->Text));
CV_Connection Connection;
Connection=(CV_Connection)GetProcAddress(hdll,"Connection"
TLoginForm *LoginForm;
bool bStatus = false;
LoginForm = new TLoginForm(Application);
try
{
LoginForm->ShowModal();
if (LoginForm->ModalResult == mrOk )
{
FStrCommPort = LoginForm->GetComPort();
FBaudRate = LoginForm->GetBautRate();
FCommModel = LoginForm->GetCommModel();
int status=Connection(7,1,"USB",6000,NULL,nAdd);
if (status==0x00)
{
AddMessage("Open USB Success!"
CV64SetMsgCallBack((CV64X0_MSGCALLBACK_TYPE)thisMSGCallBack);
}
else
{
AddMessage("Open USB Fail!"
}
//this->SetReaderBaudRate(FBaudRate);
//CloseComm();
//if(!OpenComm(FStrCommPort.c_str(),FBaudRate))
//AddMessage("Initial "+FStrCommPort+"
Baud Rate "+IntToStr(FBaudRate)+ "(OK)"
//else
AddMessage("Initial "+FStrCommPort+"
Baud Rate "+IntToStr(FBaudRate)+"(FAILED)"
EtCommPort->Text = FStrCommPort;
EtBaudRate->Text = IntToStr(FBaudRate);
bStatus = true;
}
else
{
LoginForm->Close();
bStatus = false;
}
}
__finally
{
delete LoginForm;
}
return bStatus;
}