I wouldn't be asking around here if the problem was finding the API to use...

PrintWindow works as it should, unless I hide the window. WM_PRINT only works with PRF_NONCLIENT, returning me the window border - the content is always black for some reason.
Code:
int Width = GetSystemMetrics(SM_CXSMICON);
int Height = GetSystemMetrics(SM_CYSMICON);
HWND hWndSrc = hWndOfMircPicWin;

HWND hWnd = hWndSrc;
//get first parent of picwin
//HWND hWnd = FindWindowEx(hWndSrc, NULL, NULL, NULL);

HDC hDCMem = CreateCompatibleDC(NULL);
HDC hDC = GetWindowDC(hWnd);
HBITMAP hBmp = CreateCompatibleBitmap(hDC, Width, Height);
ReleaseDC(hWnd, hDC);

HGDIOBJ hOld = SelectObject(hDCMem, hBmp);
PrintWindow(hWnd, hDCMem, PW_CLIENTONLY);
//SendMessage(hWnd, WM_PRINT, (WPARAM) hDCMem, PRF_CHILDREN | PRF_CLIENT | PRF_ERASEBKGND | PRF_NONCLIENT | PRF_OWNED);
//BitBlt(hDCMem, 0, 0, Width, Height, hDC, windowBorderLeft, windowBorderTop, SRCCOPY);
SelectObject(hDCMem, hOld);
DeleteObject(hDCMem);


Sometimes I get the odd feeling that I'm always the first person to try something...and fail miserably.

Khaled, in case you happen to read this, how does mIRC do that for /toolbar, where theres no problem to use hidden PicWins at all?

Last edited by BhaaL; 03/01/10 12:35 PM.