2012-11-11 3 views

답변

2

2 개 가지 옵션이 있습니다 :

먼저 getPixel와()을 사용할 수 있습니다. 나는 그것을 많이 사용했다. 그것은 잘 작동 : 우리의 일이 프로세서는 어떤 경우에 작동 할 수이 기능을 사용하는 경우에도 구형 영역을 따기와

COLORREF GetPixel(
    HDC hdc, 
    int nXPos, 
    int nYPos 
); 

합니다.

둘째, 화면 내용을 비트 맵으로 복사 할 수 있습니다. 그 후 당신이 등 핵심 기능 클립 보드, 코드와 공정에 배치 할 수있다 :이 필요한 경우

BOOL BitBlt(
    _In_ HDC hdcDest, 
    _In_ int nXDest, 
    _In_ int nYDest, 
    _In_ int nWidth, 
    _In_ int nHeight, 
    _In_ HDC hdcSrc, 
    _In_ int nXSrc, 
    _In_ int nYSrc, 
    _In_ DWORD dwRop 
); 

좀 더 상세한 조각을 게시 할 수 있습니다.

// Pick up the DC. 
HDC hDC = ::GetDC(m_control); 

// Pick up the second DC. 
HDC hDCMem = ::CreateCompatibleDC(hDC); 

// Create the in memory bitmap. 
HBITMAP hBitmap = ::CreateCompatibleBitmap(hDC, bmp_size_x, bmp_size_y); 

// Put bitmat into the memory DC. This will make it functional. 
HBITMAP hBmpOld = (HBITMAP)::SelectObject(hDCMem, hBitmap); 

// Clear the background. 
HBRUSH hBkgr = ::CreateSolidBrush(props.bkgr_brush); 
RECT bitmap_rect = { 0, 0, bmp_size_x, bmp_size_y }; 
::FillRect(hDCMem, &bitmap_rect, hBkgr); 
::DeleteObject(hBkgr); 

// Do the job. 
::BitBlt(hDCMem, margins_rect.left, margins_rect.top, 
    size_to_copy_x, size_to_copy_y, hDC, 
    screen_from_x, screen_from_y, SRCCOPY); 
+0

안녕하세요, 응답 해 주셔서 감사합니다. 예. 자세한 내용 미리보기를 게시 할 수 있습니까? 이건 정말 새로운 것입니다 .... – joseRo

+0

감사합니다, 어디에서 RGS의 .... hDCMem 찾을 수 있습니까? GetPixel()? – joseRo

+0

Kirill Kobelev, 코드를 실행 한 후 hMemDC 요소 안에 있습니다. error : expression cannt를 평가합니다. 크기 매개 변수에 문제가 있다고 생각합니다. marginins_rect.left, marginins_rect.top 어디에서 가져 왔습니까? 내가 hBitamp를 만들 때 hDC의 크기라고 가정하면 더 작아 질 수 있습니까? 화면 크기를 평가하는 방법은 무엇입니까? 감사합니다. – joseRo

관련 문제