zoukankan      html  css  js  c++  java
  • getpixel 取色

     1 HWND hwnd = ::FindWindow(NULL,"《天龙八部OL》");
     2     CRect rect;
     3     CString strTmp;
     4     if (hwnd != NULL)
     5     {
     6         ::SetWindowPos(hwnd,HWND_TOP,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE|SWP_SHOWWINDOW);
     7         ::GetWindowRect(hwnd,&rect);
     8         
     9         ::SetForegroundWindow(hwnd);
    10         
    11         HDC hdc=::GetDC(NULL);
    12         if (hdc==NULL)
    13         {
    14             MessageBox("getwindowDC");
    15         }
    16         ::InvalidateRect(hwnd,NULL,1);
    17 
    18         COLORREF color1=GetPixel(hdc,rect.left+250,rect.top+235);
    19         COLORREF color2=GetPixel(hdc,rect.left+265,rect.top+235);
    20         COLORREF color3=GetPixel(hdc,rect.left+260,rect.top+230);
    21         COLORREF color4=GetPixel(hdc,rect.left+260,rect.top+240);
    22         COLORREF color5=GetPixel(hdc,rect.left+200,rect.top+200);
    23         COLORREF color6=GetPixel(hdc,rect.left+180,rect.top+235);
    24         strTmp.Format("%X,%X,%X,%X,%x,%x",(DWORD)color1,(DWORD)color2,(DWORD)color3,(DWORD)color4,(DWORD)color5,(DWORD)color6);
    25     
    26         m_edtString=m_edtString+"
    "+strTmp;
    27         UpdateData(FALSE);
    28         SetCursorPos(rect.left+260,rect.top+235);
    29         mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
    30         //mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);                //不抬起不会进入。
    31 
    32         ::ReleaseDC(hwnd,hdc);
    汇编c保护内核pe学习群: 587594855 股票价值投资套利研究群 468714081 欢迎有缘的朋友一起交流心得。
  • 相关阅读:
    POJ 3126 Prime Path
    POJ 2429 GCD & LCM Inverse
    POJ 2395 Out of Hay
    【Codeforces 105D】 Bag of mice
    【POJ 3071】 Football
    【POJ 2096】 Collecting Bugs
    【CQOI 2009】 余数之和
    【Codeforces 258E】 Devu and Flowers
    【SDOI 2010】 古代猪文
    【BZOJ 2982】 combination
  • 原文地址:https://www.cnblogs.com/myart/p/3216523.html
Copyright © 2011-2022 走看看