我使用一个第三方dll,回调readNo,但是执行的时候readNo中的this的hwnd总是为空,而且也不能访问CtestDlg中的变量,请问该怎么解决typedef int (WINAPI *setread)(void(CtestDlg::*test1)(char *,char *,char *));
setread dSetReadNo;void readNo(char *a,char *b,char *c);int CtestDlg::SetReadNo(){
hDll=LoadLibrary(TEXT("xxxxDll.dll"));
dSetReadNo=(setread)GetProcAddress(hDll,"SetReadNo");
if(dSetReadNo)
return dSetReadNo(& CtestDlg::readNo);
else
return -1;
}
void CtestDlg::readNo(char *a,char *b,char *c){
this->SetDlgItemText(IDC_EDIT1,a); this为空
this->SetDlgItemText(IDC_EDIT2,b);
this->SetDlgItemText(IDC_EDIT3,c);
}
setread dSetReadNo;void readNo(char *a,char *b,char *c);int CtestDlg::SetReadNo(){
hDll=LoadLibrary(TEXT("xxxxDll.dll"));
dSetReadNo=(setread)GetProcAddress(hDll,"SetReadNo");
if(dSetReadNo)
return dSetReadNo(& CtestDlg::readNo);
else
return -1;
}
void CtestDlg::readNo(char *a,char *b,char *c){
this->SetDlgItemText(IDC_EDIT1,a); this为空
this->SetDlgItemText(IDC_EDIT2,b);
this->SetDlgItemText(IDC_EDIT3,c);
}
set的时候需要传一个hwnd,你传的是函数地址,this都没有对象
char *telno,
char *time,
char *DevID
);
int __stdcall SetReadNo(DevOnRead pp);
static void __stdcall readNo(char *a,char *b,char *c);
这样的话如果我要调用SetDlgItemText这样的非静态函数怎么办?
{
C***Dlg *pDlg = (C***Dlg *)param;
pDlg->SetDlgItemText();...
...
}