Click here to Skip to main content
15,892,797 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Global Variable Question Pin
Richard Andrew x6419-Mar-06 13:42
professionalRichard Andrew x6419-Mar-06 13:42 
GeneralRe: Global Variable Question Pin
JSadleir19-Mar-06 14:03
JSadleir19-Mar-06 14:03 
GeneralRe: Global Variable Question Pin
Chris Gao19-Mar-06 13:49
Chris Gao19-Mar-06 13:49 
QuestionCSockets and multithreading Pin
softwaremonkey19-Mar-06 11:06
softwaremonkey19-Mar-06 11:06 
AnswerRe: CSockets and multithreading Pin
Richard Andrew x6419-Mar-06 11:20
professionalRichard Andrew x6419-Mar-06 11:20 
GeneralRe: CSockets and multithreading Pin
softwaremonkey19-Mar-06 11:33
softwaremonkey19-Mar-06 11:33 
GeneralRe: CSockets and multithreading Pin
Richard Andrew x6419-Mar-06 11:47
professionalRichard Andrew x6419-Mar-06 11:47 
Questionprinting bitmaps Pin
Waldermort19-Mar-06 8:01
Waldermort19-Mar-06 8:01 
I am trying to implement print and print-preview into a non-MFC application. After a little effort I have managed to create the print-preview function and a non working print function.

I have created a function which is passed a rect for the dimensions and a hdc, this function then creates and returns a HBITMAP compatible with the hdc and the size stated in the rect. I hope to use this function for both print and print preview.

The print preview is simply a dialog box, the HBITMAP is then drawn into the client area.

I'm having problems now trying to correctly draw this bitmap to the hdc returned by printDlg(). I have read all of the (MFC only) projects here on codeproject, but I am left even more confused. I know that I need to stretch the bitmap but all I am left with is a tiny black square.

This is a portion of the print function:
    printRect.bottom = GetDeviceCaps(pd.hDC, HORZRES);
printRect.right  = GetDeviceCaps(pd.hDC, VERTRES);

StartDoc(pd.hDC,&di);
StartPage(pd.hDC);

HBITMAP table = create_printable_table(pd.hDC,&tmprect,rec);
SelectObject(buf,table);
StretchBlt(pd.hDC,0,0,printRect.right,printRect.bottom,buf,0,0,tmprect.bottom,tmprect.right,SRCCOPY);

EndPage(pd.hDC);
EndDoc(pd.hDC);

Please help me with this one, I have spend far too long splitting hairs Frown | :(

-- modified at 14:02 Sunday 19th March, 2006
AnswerRe: printing bitmaps Pin
David Crow19-Mar-06 9:04
David Crow19-Mar-06 9:04 
AnswerRe: printing bitmaps Pin
Roger Allen19-Mar-06 12:24
Roger Allen19-Mar-06 12:24 
AnswerRe: printing bitmaps Pin
Hamid_RT19-Mar-06 17:09
Hamid_RT19-Mar-06 17:09 
QuestionWhere is call for DLL within VisStu 6.0 C++ Pin
Robert Palma Jr.19-Mar-06 7:45
Robert Palma Jr.19-Mar-06 7:45 
AnswerRe: Where is call for DLL within VisStu 6.0 C++ Pin
Richard Andrew x6419-Mar-06 7:55
professionalRichard Andrew x6419-Mar-06 7:55 
GeneralRe: Where is call for DLL within VisStu 6.0 C++ Pin
Robert Palma Jr.19-Mar-06 8:11
Robert Palma Jr.19-Mar-06 8:11 
GeneralRe: Where is call for DLL within VisStu 6.0 C++ Pin
Richard Andrew x6419-Mar-06 8:17
professionalRichard Andrew x6419-Mar-06 8:17 
GeneralRe: Where is call for DLL within VisStu 6.0 C++ Pin
Robert Palma Jr.19-Mar-06 8:28
Robert Palma Jr.19-Mar-06 8:28 
QuestionWhy memcpy not correct! Pin
Hongjun Ge19-Mar-06 7:10
Hongjun Ge19-Mar-06 7:10 
AnswerRe: Why memcpy not correct! Pin
Richard Andrew x6419-Mar-06 7:26
professionalRichard Andrew x6419-Mar-06 7:26 
AnswerRe: Why memcpy not correct! Pin
Richard Andrew x6419-Mar-06 7:31
professionalRichard Andrew x6419-Mar-06 7:31 
GeneralRe: Why memcpy not correct! Pin
Hongjun Ge19-Mar-06 16:05
Hongjun Ge19-Mar-06 16:05 
AnswerRe: Why memcpy not correct! Pin
Richard Andrew x6419-Mar-06 7:41
professionalRichard Andrew x6419-Mar-06 7:41 
GeneralRe: Why memcpy not correct! Pin
bob1697219-Mar-06 8:04
bob1697219-Mar-06 8:04 
GeneralRe: Why memcpy not correct! Pin
Richard Andrew x6419-Mar-06 8:14
professionalRichard Andrew x6419-Mar-06 8:14 
GeneralRe: Why memcpy not correct! Pin
bob1697219-Mar-06 8:26
bob1697219-Mar-06 8:26 
AnswerRe: Why memcpy not correct! Pin
bob1697219-Mar-06 7:58
bob1697219-Mar-06 7:58 

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.