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