int getcolorof00()
{
int islei=1;
int r=0,g=0,b=0;
COLORREF clr;
HDC hdc= ::GetDC(NULL);
HWND saoleihwnd=::FindWindow(NULL,"扫雷");
clr = ::GetPixel(hdc, 0, 0);
r = GetRValue(clr);
g = GetGValue(clr);
b = GetBValue(clr);
if(r==255&&g==255&&b==255){
islei=0;
}
else
{
islei=1+r+g+b;
}
::ReleaseDC(NULL, hdc);
return islei;
}
void CAutosaoleiDlg::OnButton1()
{
kaiqipojie();
::Sleep(50);
int count1=0;
int location;
location=3932178;
int m;
for(;count1<16;count1++){
for(int count2=0;count2<30;count2++){
::PostMessage(::FindWindow(NULL,"扫雷"),WM_MOUSEMOVE,NULL,location);
::Sleep(20);
m=getcolorof00();
// ::Sleep(20);
if(m==0)
{
::PostMessage(::FindWindow(NULL,"扫雷"),WM_LBUTTONDOWN,NULL,location);
::PostMessage(::FindWindow(NULL,"扫雷"),WM_LBUTTONUP,NULL,location);
}else
{
::PostMessage(::FindWindow(NULL,"扫雷"),WM_RBUTTONDOWN,NULL,location);
::PostMessage(::FindWindow(NULL,"扫雷"),WM_RBUTTONUP,NULL,location);
}
location+=16;
}
location-=480;
location+=1048576;
}
}
void CAutosaoleiDlg::kaiqipojie()
{
if(pojie==0){
::PostMessage(::FindWindow(NULL,"扫雷"),WM_KEYDOWN,88,0);
::PostMessage(::FindWindow(NULL,"扫雷"),WM_KEYUP,88,0);
::PostMessage(::FindWindow(NULL,"扫雷"),WM_KEYDOWN,89,0);
::PostMessage(::FindWindow(NULL,"扫雷"),WM_KEYUP,89,0);
::PostMessage(::FindWindow(NULL,"扫雷"),WM_KEYDOWN,90,0);
::PostMessage(::FindWindow(NULL,"扫雷"),WM_KEYUP,90,0);
::PostMessage(::FindWindow(NULL,"扫雷"),WM_KEYDOWN,90,0);
::PostMessage(::FindWindow(NULL,"扫雷"),WM_KEYUP,90,0);
::PostMessage(::FindWindow(NULL,"扫雷"),WM_KEYDOWN,89,0);
::PostMessage(::FindWindow(NULL,"扫雷"),WM_KEYUP,89,0);
::PostMessage(::FindWindow(NULL,"扫雷"),WM_KEYDOWN,VK_SHIFT,0);
::PostMessage(::FindWindow(NULL,"扫雷"),WM_KEYUP,VK_SHIFT,0);
pojie=1;
}
}