XP自动扫雷

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;
 }

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值