Click here to Skip to main content
15,909,953 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: CString trouble Pin
toxcct1-Aug-07 22:55
toxcct1-Aug-07 22:55 
AnswerRe: CString trouble Pin
Don Box1-Aug-07 23:21
Don Box1-Aug-07 23:21 
AnswerRe: CString trouble Pin
Michael Dunn2-Aug-07 8:18
sitebuilderMichael Dunn2-Aug-07 8:18 
QuestionHow to replace a CDC of another CWnd Pin
FlyingBear1-Aug-07 22:50
FlyingBear1-Aug-07 22:50 
QuestionRe: How to replace a CDC of another CWnd Pin
Hamid_RT1-Aug-07 22:56
Hamid_RT1-Aug-07 22:56 
AnswerRe: How to replace a CDC of another CWnd Pin
FlyingBear1-Aug-07 23:17
FlyingBear1-Aug-07 23:17 
AnswerRe: How to replace a CDC of another CWnd Pin
FlyingBear1-Aug-07 23:22
FlyingBear1-Aug-07 23:22 
AnswerRe: How to replace a CDC of another CWnd Pin
Iain Clarke, Warrior Programmer1-Aug-07 23:52
Iain Clarke, Warrior Programmer1-Aug-07 23:52 
This isn't tested, or even compiled, just quickly typed up...

CClientDC   dcOther (GetDesktopWindow ()); // grabs the other DC
CRect rc;
::GetWindowRect (hWndToClone, &rc); // how big is it?

CBitmap bmpTemp, *bmpOld;
CDC dcClone;
dcClone.CreateCompatibleDC (&dcOther);
bmpTemp.CreateCompatibleBmp (&dcOther, rc.Width (), rc.Height ());
bmpOld = dcClone.SelectObject (&bmpTemp);

dcClone.BitBlt (0,0, rc.Width (), rc.Height (), &dcOther, 0,0, SRCCPY);

dcClone.SelectObject (bmpOld); // tidy up


and now dcClone should hold a copy of the contents of the first window - or at least what it shows on the screen.

You should look at the very useful article by PJ Arends: Image Viewer[^].

Good luck,

Iain.




GeneralRe: How to replace a CDC of another CWnd Pin
FlyingBear2-Aug-07 0:41
FlyingBear2-Aug-07 0:41 
GeneralRe: How to replace a CDC of another CWnd Pin
Iain Clarke, Warrior Programmer2-Aug-07 1:16
Iain Clarke, Warrior Programmer2-Aug-07 1:16 
GeneralRe: How to replace a CDC of another CWnd Pin
FlyingBear2-Aug-07 2:30
FlyingBear2-Aug-07 2:30 
GeneralRe: How to replace a CDC of another CWnd Pin
Hamid_RT2-Aug-07 2:47
Hamid_RT2-Aug-07 2:47 
GeneralRe: How to replace a CDC of another CWnd Pin
FlyingBear2-Aug-07 3:57
FlyingBear2-Aug-07 3:57 
GeneralRe: How to replace a CDC of another CWnd Pin
Hamid_RT2-Aug-07 5:09
Hamid_RT2-Aug-07 5:09 
AnswerRe: How to replace a CDC of another CWnd Pin
Iain Clarke, Warrior Programmer1-Aug-07 23:23
Iain Clarke, Warrior Programmer1-Aug-07 23:23 
GeneralRe: How to replace a CDC of another CWnd Pin
FlyingBear2-Aug-07 0:25
FlyingBear2-Aug-07 0:25 
QuestionRe: How to replace a CDC of another CWnd Pin
Mark Salsbery2-Aug-07 9:27
Mark Salsbery2-Aug-07 9:27 
AnswerRe: How to replace a CDC of another CWnd Pin
Michael Dunn2-Aug-07 8:18
sitebuilderMichael Dunn2-Aug-07 8:18 
GeneralRe: How to replace a CDC of another CWnd Pin
FlyingBear2-Aug-07 8:53
FlyingBear2-Aug-07 8:53 
AnswerRe: How to replace a CDC of another CWnd Pin
FlyingBear2-Aug-07 19:21
FlyingBear2-Aug-07 19:21 
QuestionEnable C++ Exceptions Pin
Tal S.1-Aug-07 22:37
Tal S.1-Aug-07 22:37 
AnswerRe: Enable C++ Exceptions Pin
Russell'2-Aug-07 2:35
Russell'2-Aug-07 2:35 
QuestionRunning 10 threads at a time Pin
neha.agarwal271-Aug-07 22:22
neha.agarwal271-Aug-07 22:22 
AnswerRe: Running 10 threads at a time Pin
Iain Clarke, Warrior Programmer1-Aug-07 22:48
Iain Clarke, Warrior Programmer1-Aug-07 22:48 
AnswerRe: Running 10 threads at a time Pin
Iain Clarke, Warrior Programmer1-Aug-07 22:52
Iain Clarke, Warrior Programmer1-Aug-07 22:52 

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.