Click here to Skip to main content
16,017,333 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to populate a CBitmap correctly Pin
Naveen3-Jun-07 16:01
Naveen3-Jun-07 16:01 
GeneralRe: How to populate a CBitmap correctly Pin
C. Tam3-Jun-07 18:29
C. Tam3-Jun-07 18:29 
GeneralRe: How to populate a CBitmap correctly Pin
Naveen3-Jun-07 18:34
Naveen3-Jun-07 18:34 
GeneralRe: How to populate a CBitmap correctly Pin
C. Tam3-Jun-07 21:02
C. Tam3-Jun-07 21:02 
GeneralRe: How to populate a CBitmap correctly Pin
Naveen3-Jun-07 21:07
Naveen3-Jun-07 21:07 
GeneralRe: How to populate a CBitmap correctly Pin
C. Tam4-Jun-07 0:36
C. Tam4-Jun-07 0:36 
GeneralRe: How to populate a CBitmap correctly Pin
Naveen4-Jun-07 14:01
Naveen4-Jun-07 14:01 
GeneralRe: How to populate a CBitmap correctly Pin
C. Tam5-Jun-07 15:57
C. Tam5-Jun-07 15:57 
Thanks for your reply. I got it to compile after installing Platform SDK Feb 2003 which is compatible with VS C++ 6.

Below is the updated function.
Is it correct? Would it leak any resources?
How should I clean up bitmap_output after use?

<br />
void CopyToBitmap(CWMPPlayer4& player, CBitmap& bitmap_output)<br />
{<br />
  CClientDC player_dc(&player);<br />
  CRect player_rc;<br />
  player.GetClientRect( player_rc );<br />
  CSize player_sc(player_rc.Width(), player_rc.Height());<br />
  bitmap_output.CreateCompatibleBitmap(&player_dc, player_sc.cx, player_sc.cy);<br />
<br />
  CDC* dc_p = this->GetDC();<br />
  CDC bitmap_dc;<br />
  bitmap_dc.CreateCompatibleDC( dc_p );<br />
  CBitmap *prev_bitmap_p = bitmap_dc.SelectObject( &bitmap_output );<br />
  PrintWindow( player.m_hWnd, (HDC)bitmap_dc, PW_CLIENTONLY );<br />
  bitmap_dc.SelectObject( prev_bitmap_p );<br />
  ReleaseDC( dc_p );<br />
}

GeneralRe: How to populate a CBitmap correctly Pin
Naveen5-Jun-07 16:00
Naveen5-Jun-07 16:00 
GeneralRe: How to populate a CBitmap correctly [modified] Pin
C. Tam5-Jun-07 20:05
C. Tam5-Jun-07 20:05 
GeneralRe: How to populate a CBitmap correctly Pin
Naveen6-Jun-07 13:10
Naveen6-Jun-07 13:10 
GeneralRe: How to populate a CBitmap correctly Pin
C. Tam6-Jun-07 15:56
C. Tam6-Jun-07 15:56 
GeneralRe: How to populate a CBitmap correctly Pin
Naveen6-Jun-07 15:59
Naveen6-Jun-07 15:59 
GeneralRe: How to populate a CBitmap correctly Pin
C. Tam6-Jun-07 19:38
C. Tam6-Jun-07 19:38 
GeneralRe: How to populate a CBitmap correctly Pin
Naveen6-Jun-07 19:55
Naveen6-Jun-07 19:55 
GeneralRe: How to populate a CBitmap correctly Pin
C. Tam7-Jun-07 15:28
C. Tam7-Jun-07 15:28 
GeneralRe: How to populate a CBitmap correctly Pin
Naveen7-Jun-07 16:39
Naveen7-Jun-07 16:39 
GeneralRe: How to populate a CBitmap correctly Pin
Mark Salsbery4-Jun-07 5:31
Mark Salsbery4-Jun-07 5:31 
GeneralRe: How to populate a CBitmap correctly Pin
C. Tam4-Jun-07 9:26
C. Tam4-Jun-07 9:26 
QuestionMixing ATL and MFC Pin
Anorexic Tribble3-Jun-07 7:40
Anorexic Tribble3-Jun-07 7:40 
AnswerRe: Mixing ATL and MFC Pin
Matthew Faithfull3-Jun-07 8:25
Matthew Faithfull3-Jun-07 8:25 
GeneralRe: Mixing ATL and MFC Pin
Stephen Hewitt3-Jun-07 14:05
Stephen Hewitt3-Jun-07 14:05 
Questionsimple problem Pin
Software_Specialist3-Jun-07 4:30
Software_Specialist3-Jun-07 4:30 
AnswerRe: simple problem Pin
Arman S.3-Jun-07 5:06
Arman S.3-Jun-07 5:06 
GeneralRe: simple problem Pin
Software_Specialist3-Jun-07 5:10
Software_Specialist3-Jun-07 5:10 

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.