#include <iostream>
using namespace std;
void CScreenShotDlg::OnPaint()
{
    // device context for painting
    CPaintDC dc(this);
    // Get the window handle of calculator application.
    HWND hWnd = ::FindWindow( 0, _T( "Calculator" ));
    // Take screenshot.
    PrintWindow( hWnd,
                 dc.GetSafeHdc(),
                 0 );
}  
  
  С плюсами толком не знаком.