Click here to Skip to main content
15,912,400 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to create combo box in a gridline of a list control Pin
Hamid_RT17-Aug-06 2:50
Hamid_RT17-Aug-06 2:50 
QuestionHow to remove the Frame for SDI Application Pin
kiranin17-Aug-06 0:55
kiranin17-Aug-06 0:55 
AnswerRe: How to remove the Frame for SDI Application Pin
prasad_som17-Aug-06 1:03
prasad_som17-Aug-06 1:03 
GeneralRe: How to remove the Frame for SDI Application Pin
kiranin17-Aug-06 3:34
kiranin17-Aug-06 3:34 
AnswerRe: How to remove the Frame for SDI Application Pin
prasad_som17-Aug-06 3:37
prasad_som17-Aug-06 3:37 
QuestionHow to Get The Size of MDI Min Window Pin
cybersadhu17-Aug-06 0:41
cybersadhu17-Aug-06 0:41 
AnswerRe: How to Get The Size of MDI Min Window Pin
prasad_som17-Aug-06 0:47
prasad_som17-Aug-06 0:47 
QuestionPrinting a screen image (StretchBlt error) Pin
Wim Engberts17-Aug-06 0:26
Wim Engberts17-Aug-06 0:26 
I am writing a graphic design tool. I am using a device context to produce the image on screen. Now I want to be able to print the image to the printer. What I am doing so far is:

Create the screen device context : CDC *m_pDC = CreateDC ();
Do all kinds of weird and wonderful things to produce the image (all of this works, since I do get the image I want on screen)
When the user presses the Print option from the menu, I use the CPrintDialog class to select the printer, and subsequently I get a HDC by “CPrintDialog Print.CreatePrinterDC ();”
Then I calculate the size on paper by the following piece of code:

POINT point;
POINT start;

point.x = GetDeviceCaps (hDC, PHYSICALWIDTH);
start.x = GetDeviceCaps (hDC, PHYSICALOFFSETX);
point.x -= (start.x*2);
point.y = GetDeviceCaps (hDC, PHYSICALHEIGHT);
start.y = GetDeviceCaps (hDC, PHYSICALOFFSETY);
point.y -= (start.y*2);
DPtoLP (hDC, &point, 1);
DPtoLP (hDC, &start, 1);

I already have a POINT named “Source”, that holds the size of the screen DC.
Then I call:

if (!StretchBlt (hDC, start.x, start.y, point.x, point.y, m_pDC->GetSafeHwnd (), 0, 0, Source.x, Source.y, SRCCOPY))

And this is where all goes wrong! This fails, and the error message (as obtained by FormatMessage and GetLastError) says: “The parameter is incorrect”

As far as I can see, the size on paper is correct, since I also write a (test) rectangle with these positions: Rectangle (hDC, start.x, start.y, point.x, point.y); and this produces a rectangle on paper with the size and position as I would expect.

Can anyone help me out here.

William



-- modified at 7:29 Thursday 17th August, 2006
AnswerRe: Printing a screen image Pin
Sarath C17-Aug-06 0:44
Sarath C17-Aug-06 0:44 
GeneralRe: Printing a screen image Pin
Wim Engberts17-Aug-06 1:28
Wim Engberts17-Aug-06 1:28 
GeneralRe: Printing a screen image Pin
Sarath C17-Aug-06 6:11
Sarath C17-Aug-06 6:11 
AnswerRe: Printing a screen image (StretchBlt error) Pin
Chris Losinger17-Aug-06 1:40
professionalChris Losinger17-Aug-06 1:40 
AnswerRe: Printing a screen image (StretchBlt error) Pin
prasad_som17-Aug-06 3:07
prasad_som17-Aug-06 3:07 
GeneralRe: Printing a screen image (StretchBlt error) Pin
Wim Engberts17-Aug-06 3:46
Wim Engberts17-Aug-06 3:46 
GeneralRe: Printing a screen image (StretchBlt error) Pin
prasad_som17-Aug-06 18:56
prasad_som17-Aug-06 18:56 
Questionedit boxes and files Pin
meriawaz17-Aug-06 0:13
meriawaz17-Aug-06 0:13 
AnswerRe: edit boxes and files Pin
Wim Engberts17-Aug-06 0:29
Wim Engberts17-Aug-06 0:29 
Questionsearching the folder in a file Pin
Anu_Bala17-Aug-06 0:11
Anu_Bala17-Aug-06 0:11 
AnswerRe: searching the folder in a file Pin
Hamid_RT17-Aug-06 0:21
Hamid_RT17-Aug-06 0:21 
GeneralRe: searching the folder in a file Pin
Anu_Bala17-Aug-06 0:47
Anu_Bala17-Aug-06 0:47 
GeneralRe: searching the folder in a file Pin
prasad_som17-Aug-06 0:51
prasad_som17-Aug-06 0:51 
GeneralRe: searching the folder in a file Pin
Anu_Bala17-Aug-06 1:43
Anu_Bala17-Aug-06 1:43 
GeneralRe: searching the folder in a file Pin
Hamid_RT17-Aug-06 2:44
Hamid_RT17-Aug-06 2:44 
GeneralRe: searching the folder in a file Pin
Cedric Moonen17-Aug-06 0:53
Cedric Moonen17-Aug-06 0:53 
QuestionHow to get the Scrollbar's thumb coordinates? Pin
Don Box17-Aug-06 0:06
Don Box17-Aug-06 0:06 

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.