Click here to Skip to main content
15,914,246 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Image list control Pin
subir talukder13-Jan-01 20:35
subir talukder13-Jan-01 20:35 
GeneralNetwork Communication Pin
The Homer13-Jan-01 2:48
The Homer13-Jan-01 2:48 
GeneralRe: Network Communication Pin
Anders Molin13-Jan-01 7:15
professionalAnders Molin13-Jan-01 7:15 
GeneralRe: Network Communication Pin
3-May-01 3:00
suss3-May-01 3:00 
GeneralRe: Network Communication Pin
Anders Molin3-May-01 3:15
professionalAnders Molin3-May-01 3:15 
GeneralAdding a Menu to a dialog Pin
12-Jan-01 16:32
suss12-Jan-01 16:32 
GeneralRe: Adding a Menu to a dialog Pin
12-Jan-01 19:26
suss12-Jan-01 19:26 
GeneralMAPI (read mail) in C++ - HOW TO Pin
12-Jan-01 11:35
suss12-Jan-01 11:35 
GeneralDocking Problem Pin
12-Jan-01 11:05
suss12-Jan-01 11:05 
GeneralRe: Docking Problem Pin
Christian Graus13-Jan-01 8:54
protectorChristian Graus13-Jan-01 8:54 
GeneralAdd a view to an App Pin
12-Jan-01 11:04
suss12-Jan-01 11:04 
GeneralRe: Add a view to an App Pin
13-Jan-01 5:44
suss13-Jan-01 5:44 
GeneralFormatMessage Error : ERROR_MR_MID_NOT_FOUND Pin
tatazou12-Jan-01 4:58
tatazou12-Jan-01 4:58 
GeneralRe: FormatMessage Error : ERROR_MR_MID_NOT_FOUND Pin
Ghazi H. Wadi12-Jan-01 11:43
Ghazi H. Wadi12-Jan-01 11:43 
GeneralRe: FormatMessage Error : ERROR_MR_MID_NOT_FOUND Pin
tatazou15-Jan-01 4:15
tatazou15-Jan-01 4:15 
QuestionHow to detect when the view is finished resizing Pin
12-Jan-01 4:18
suss12-Jan-01 4:18 
AnswerRe: How to detect when the view is finished resizing Pin
NormDroid12-Jan-01 4:38
professionalNormDroid12-Jan-01 4:38 
GeneralSelect a pen color Pin
.::RockNix::.12-Jan-01 3:23
.::RockNix::.12-Jan-01 3:23 
GeneralRe: Select a pen color Pin
David Fedolfi12-Jan-01 8:20
David Fedolfi12-Jan-01 8:20 
GeneralRe: Select a pen color Pin
.::RockNix::.15-Jan-01 1:19
.::RockNix::.15-Jan-01 1:19 
GeneralPlease tell me what's wrong in here... Pin
Jason Troitsky12-Jan-01 1:19
Jason Troitsky12-Jan-01 1:19 
I want to get a snapshot of the desktop, so I am trying to 'hide' the calling window, get the snapshot and then show the window and blit the snapshot to it's DC.

It works, but it seems to be capturing the calling DC (the one I'm hiding)....?

Here's the code:


///////////////////////////////////////////////////////////////////////////////////////////////////////////Function Header
void CDCUtils::PaintDesktop( CDC *pDC, CWnd* pWnd, CRect rect, bool bHideWindow )
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
{
CDC dcDesktop;
CDC dcBuffer;
CBitmap bmpBuffer;
CBitmap bmpDesktop;
CRect LastRect;

CWnd* pFrameWnd = pWnd->GetParentFrame();
pFrameWnd->GetWindowRect( LastRect );

//CPoint Point( rect.left, rect.top );
//HWND hWnd = pWnd->GetSafeHwnd();
//ClientToScreen(hWnd, &Point);
CPoint Point( LastRect.left, LastRect.top );

// Get the Calling Window out the way, so that we can get a clean snapshot...

if ( bHideWindow)
{
pFrameWnd->SetWindowPos( NULL, -100,0,0,0, NULL );
Sleep(400);
}

//
// Get the Desktop's Device Context
//

dcDesktop.m_hDC = ::GetDC(NULL);

//
// Initialise the bitmap according to the Desktop DC
//

bmpDesktop.CreateCompatibleBitmap( &dcDesktop,
GetSystemMetrics(SM_CXSCREEN),
GetSystemMetrics(SM_CYSCREEN));

//
// Create a buffer DC that has a bmp associated with it
//

dcBuffer.CreateCompatibleDC(&dcDesktop);
dcBuffer.SelectObject(bmpDesktop);

//
// Blit from the Desktop's (point.x, point.y) to the buffer's rectangle: 0,0,width,height
//

dcBuffer.BitBlt( 0,
0,
rect.Width(),
rect.Height(),
&dcDesktop, // From DC
Point.y,
Point.y,
SRCCOPY);

if ( bHideWindow)
{
pFrameWnd->SetWindowPos( NULL, LastRect.left, LastRect.top, LastRect.Width(), LastRect.Height(), NULL );
}

pDC->BitBlt( rect.left,
rect.top,
rect.Width(),
rect.Height(),
&dcBuffer, // From DC
0,
0,
SRCCOPY);

dcDesktop.DeleteDC();
dcBuffer.DeleteDC();

bmpDesktop.DeleteObject();
bmpBuffer.DeleteObject();
}


GeneralRe: Please tell me what's wrong in here... Pin
Christian Graus12-Jan-01 10:03
protectorChristian Graus12-Jan-01 10:03 
GeneralRe: Please tell me what's wrong in here... Pin
Jason Troitsky13-Jan-01 4:41
Jason Troitsky13-Jan-01 4:41 
GeneralRe: Please tell me what's wrong in here... Pin
Anders Molin13-Jan-01 7:22
professionalAnders Molin13-Jan-01 7:22 
QuestionHow to create a custom window class name in MFC Pin
James Spibey12-Jan-01 0:50
James Spibey12-Jan-01 0:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.