How to capture the desktop image behind my main window
-
I want to capture the desktop image behind my main window.I used HDC hDesktopDC = GetDC(NULL); RECT rect; GetWindowRect(&rect); ...... BitBlt(hMemDC, 0,0, nWidth, nHeight, hDesktopDC, rect->left, rect->top, SRCCOPY); hBitmap = (HBITMAP)SelectObject(hMemDC, hOldBitmap); but, the image I got was my window,not Its background. what's the matter? How could I get the image behind my main window? Thanks guys!
-
I want to capture the desktop image behind my main window.I used HDC hDesktopDC = GetDC(NULL); RECT rect; GetWindowRect(&rect); ...... BitBlt(hMemDC, 0,0, nWidth, nHeight, hDesktopDC, rect->left, rect->top, SRCCOPY); hBitmap = (HBITMAP)SelectObject(hMemDC, hOldBitmap); but, the image I got was my window,not Its background. what's the matter? How could I get the image behind my main window? Thanks guys!
Hide your window first by calling
ShowWindow(hwnd, SW_HIDE)
.Best wishes, Hans
-
I want to capture the desktop image behind my main window.I used HDC hDesktopDC = GetDC(NULL); RECT rect; GetWindowRect(&rect); ...... BitBlt(hMemDC, 0,0, nWidth, nHeight, hDesktopDC, rect->left, rect->top, SRCCOPY); hBitmap = (HBITMAP)SelectObject(hMemDC, hOldBitmap); but, the image I got was my window,not Its background. what's the matter? How could I get the image behind my main window? Thanks guys!
You can minimize your application window first and then get the hWnd to the desktop window using the GetDesktopWindow.[^]Then you can maximize your application back again.
I am a HUMAN. I have that keyword in my name........ ;-)_AnsHUMAN_
-
Hide your window first by calling
ShowWindow(hwnd, SW_HIDE)
.Best wishes, Hans
-
I want to capture the desktop image behind my main window.I used HDC hDesktopDC = GetDC(NULL); RECT rect; GetWindowRect(&rect); ...... BitBlt(hMemDC, 0,0, nWidth, nHeight, hDesktopDC, rect->left, rect->top, SRCCOPY); hBitmap = (HBITMAP)SelectObject(hMemDC, hOldBitmap); but, the image I got was my window,not Its background. what's the matter? How could I get the image behind my main window? Thanks guys!