Click here to Skip to main content
15,914,070 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionAny ideas on reducing link times? Pin
Chris Hafey17-May-01 15:18
Chris Hafey17-May-01 15:18 
AnswerRe: Any ideas on reducing link times? Pin
Anders Molin17-May-01 23:57
professionalAnders Molin17-May-01 23:57 
GeneralRe: Any ideas on reducing link times? Pin
Gerry18-May-01 3:30
Gerry18-May-01 3:30 
GeneralRe: Any ideas on reducing link times? Pin
18-May-01 4:52
suss18-May-01 4:52 
GeneralPrinting under MFC - ARGH !!! Pin
Christian Graus17-May-01 14:57
protectorChristian Graus17-May-01 14:57 
GeneralRe: Printing under MFC - ARGH !!! Pin
l a u r e n18-May-01 12:51
l a u r e n18-May-01 12:51 
GeneralRe: Printing under MFC - ARGH !!! Pin
Christian Graus18-May-01 12:59
protectorChristian Graus18-May-01 12:59 
GeneralRe: Printing under MFC - ARGH !!! Pin
CodeGuy18-May-01 16:50
CodeGuy18-May-01 16:50 
Christian,

The CPrintDialog class contains a function to obtain the DC handle. Once you have the HDC, you can obtain the margins of the page.

In other words,

CPrintDialog dlg(TRUE); // or dlg(FALSE); gives you different Print Setup options
if (dlg.DoModal() == IDOK)
{
HDC hdc = dlg.GetPrinterDC();
long width = ::GetDeviceCaps(hdc, PHYSICALWIDTH)
- ::GetDeviceCaps(hdc, PHYSICALOFFSETX)*2;
long height = ::GetDeviceCaps(hdc, PHYSICALHEIGHT)
- ::GetDeviceCaps(hdc, PHYSICALOFFSETY)*2;
}

Keep in mind that you will probably have to add a little more margin than what the PHYSICALOFFSET constants return if you are printing on the edges. Many printers still cut off items that are printed on the edge of the margins. I usually just multiply the PHYSICALOFFSET by 3 instead of 2, and that takes care of the problem.

Mmm, chocolate.

GeneralUnicode File I/O Pin
Shankar Chandra Bose17-May-01 14:35
Shankar Chandra Bose17-May-01 14:35 
GeneralRe: Unicode File I/O Pin
l a u r e n18-May-01 12:53
l a u r e n18-May-01 12:53 
GeneralCRecordset and SQL Server 2000 Pin
SuperGeek17-May-01 11:15
SuperGeek17-May-01 11:15 
GeneralRe: CRecordset and SQL Server 2000 Pin
4-Sep-01 1:27
suss4-Sep-01 1:27 
GeneralCFormView Throwing Exception Pin
Christopher17-May-01 10:45
Christopher17-May-01 10:45 
GeneralEjecting a CD Pin
17-May-01 8:53
suss17-May-01 8:53 
GeneralRe: Ejecting a CD Pin
Ed Dixon17-May-01 9:21
Ed Dixon17-May-01 9:21 
GeneralRe: Ejecting a CD Pin
Tomasz Sowinski17-May-01 9:28
Tomasz Sowinski17-May-01 9:28 
GeneralRe: Ejecting a CD Pin
17-May-01 18:11
suss17-May-01 18:11 
GeneralRe: Ejecting a CD Pin
Anders Molin17-May-01 23:54
professionalAnders Molin17-May-01 23:54 
GeneralRe: Ejecting a CD Pin
18-May-01 4:01
suss18-May-01 4:01 
GeneralRe: Ejecting a CD Pin
Carlos Antollini17-May-01 9:49
Carlos Antollini17-May-01 9:49 
QuestionHow to make an output file in VC++ Pin
mr200317-May-01 8:49
mr200317-May-01 8:49 
AnswerRe: How to make an output file in VC++ Pin
Ravi Bhavnani17-May-01 10:08
professionalRavi Bhavnani17-May-01 10:08 
GeneralDynamic creation of objects Pin
Luis Barreira17-May-01 7:57
Luis Barreira17-May-01 7:57 
GeneralRe: Dynamic creation of objects Pin
Chris Losinger17-May-01 8:11
professionalChris Losinger17-May-01 8:11 
GeneralRe: Dynamic creation of objects Pin
MikeG18-May-01 3:12
MikeG18-May-01 3:12 

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.