Well i created a program to capture window desktop MainWnd class encapsulates 2 member vars
1-dw
boolean flag indicating that the window created by app is for drawing
2-pw
indicating app that current window is parent window
Now in my Paint function i have done this
void MainWnd::OnPaint(){
//going to draw bmp only when it is dw and not pw
if(dw && !pw){
CDC dskTop;
CBitmap img;
CWnd *DTW=GetDesktopWindow(); //obtained desktop window
dskTop.CreateCompatibleDC(DTW->GetDC()); //made compatible dc
img.CreateCompatibleBitmap(DTW->GetDC(),WinSize.cx,WinSize.cy); //made comp bmp
dskTop.SelectObject(&img); //selected bmp
dskTop.BitBlt(0,0,WinSize.cx,WinSize.cy,DTW->GetDC(),0,0,SRCCOPY); //blitted
CPaintDC dc(this); //time to draw
dc.CreateCompatibleDC(&dskTop); /*same thing happens even i don`t include this line*/
dc.BitBlt(0,0,WinSize.cx,WinSize.cy,&dskTop,0,0,SR CCOPY); //blitted on paintdc
}
}
but the screen appeares white
Also i want a some help to save CBitmap to a file