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

C / C++ / MFC

 
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 
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 
I've updated the code to use player_dc as below. Thanks for inputs.

During testing, I've discovered that the app does not work all the time.
So far, it works on XPProSP2 hosted on MS Virtual PC 2004.
However, it doesn't work on XPProSP2 running on a real computer. The CBitmap's output is black.
How do I resolve this problem?

<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 bitmap_dc;<br />
  bitmap_dc.CreateCompatibleDC( &player_dc );<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 />
}<br />




-- modified at 4:33 Wednesday 6th June, 2007
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 
Questioncode to search in a text file Pin
non light3-Jun-07 3:10
non light3-Jun-07 3:10 
AnswerRe: code to search in a text file Pin
CPallini3-Jun-07 3:52
mveCPallini3-Jun-07 3: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.