代码如下
CString str1;
extern char m_phone[50];
extern int count;
int n=0;
GetDlgItemText(IDC_DESKEY,str1);
if(str1.GetLength()==0)
{
this->MessageBox("请先输入密钥");
return;
}
else if (str1.GetLength()>=9)
{
this->MessageBox("密钥过长,请重新输入");
return;
}
for(n=0;n<=count;n++)
{
char skey[32];
char inbuff[32],oubuff[32];
memcpy(skey,(LPCTSTR)m_key,8);
memcpy(inbuff,(LPCTSTR)m_phone[n],8); CString strTmp,str; DES jm ;
jm.Des_Go(oubuff, inbuff, sizeof(inbuff), skey,sizeof(skey), ENCRYPT);
for(int i=0;i<32;i++)
str+=oubuff[i];
m_listctrl.SetItemText(0,2,str);
}编译错误,'m_listctrl' : undeclared identifier,请问如何能正确引用,还有m_phone[50]与count也是在父对话框中某函数定义的,如此引用是否正确?
CString str1;
extern char m_phone[50];
extern int count;
int n=0;
GetDlgItemText(IDC_DESKEY,str1);
if(str1.GetLength()==0)
{
this->MessageBox("请先输入密钥");
return;
}
else if (str1.GetLength()>=9)
{
this->MessageBox("密钥过长,请重新输入");
return;
}
for(n=0;n<=count;n++)
{
char skey[32];
char inbuff[32],oubuff[32];
memcpy(skey,(LPCTSTR)m_key,8);
memcpy(inbuff,(LPCTSTR)m_phone[n],8); CString strTmp,str; DES jm ;
jm.Des_Go(oubuff, inbuff, sizeof(inbuff), skey,sizeof(skey), ENCRYPT);
for(int i=0;i<32;i++)
str+=oubuff[i];
m_listctrl.SetItemText(0,2,str);
}编译错误,'m_listctrl' : undeclared identifier,请问如何能正确引用,还有m_phone[50]与count也是在父对话框中某函数定义的,如此引用是否正确?
可以用GetParent()获取父窗口的指针
可以把m_phone[50]与count作为父对话框的成员变量
((主对话框*)GetParent())->m_phone[50]
((主对话框*)GetParent())->count
进而引用其变量
或者通过GetParent获取父窗口句柄
然后通过自定义消息让父窗口自己完成相关操作