Click here to Skip to main content
14,333,124 members

C / C++ / MFC

 
AnswerRe: launch a word processor(MS Word) in an MS Visual C++ dialog based application Pin
_Flaviu14-Sep-18 0:42
member_Flaviu14-Sep-18 0:42 
GeneralRe: launch a word processor(MS Word) in an MS Visual C++ dialog based application Pin
zigie16-Sep-18 18:04
memberzigie16-Sep-18 18:04 
QuestionRe: launch a word processor(MS Word) in an MS Visual C++ dialog based application Pin
David Crow14-Sep-18 3:01
memberDavid Crow14-Sep-18 3:01 
AnswerRe: launch a word processor(MS Word) in an MS Visual C++ dialog based application Pin
zigie16-Sep-18 18:14
memberzigie16-Sep-18 18:14 
QuestionThe mismatch between Print preview and the real printing Pin
Member 1388734912-Sep-18 0:47
memberMember 1388734912-Sep-18 0:47 
AnswerRe: The mismatch between Print preview and the real printing Pin
Richard MacCutchan12-Sep-18 0:57
protectorRichard MacCutchan12-Sep-18 0:57 
GeneralRe: The mismatch between Print preview and the real printing Pin
Member 1388734912-Sep-18 2:03
memberMember 1388734912-Sep-18 2:03 
GeneralRe: The mismatch between Print preview and the real printing Pin
leon de boer12-Sep-18 7:05
memberleon de boer12-Sep-18 7:05 
The screen works on 96DPI unless you are in a DPI aware app which if you want to confirm
HDC screen = GetDC(0);
long hPixelsPerInch = GetDeviceCaps(screen,LOGPIXELSX);
long vPixelsPerInch = GetDeviceCaps(screen,LOGPIXELSY);

So it's setup that 96 pixels = 1 inch, not in the real world but that is what 96 pixel represents on screen

When you map it to 0.1mm per device space 25.4mm = 1 inch so 254 pixels now = 1 inch

Now the same works for the resolution of your printer depending on it's resolution
So lets say you are printing at 150dpi on the printer so when you set it to 0.1mm per device unit
1500 pixels = 1 inch on the printer

Normallly the printer select dialog goes close because it knows the screen is 96DPI and it knows what the
printer DPI is but you have messed about with the modes and thrown it out by a fair bit.
It's usually pretty close all by itself Smile | :)

Anyhow the scaling is easy .... correct size = size * effective Printer DPI / effective Screen DPI;

When you select the printer you can get it's DC and pass it into the code above and get it's hPixelsPerInch
and vPixelsPerInch just as you did the screen. Hence you can work out the scale.
In vino veritas


modified 12-Sep-18 13:16pm.

GeneralRe: The mismatch between Print preview and the real printing Pin
Member 1388734912-Sep-18 21:07
memberMember 1388734912-Sep-18 21:07 
GeneralRe: The mismatch between Print preview and the real printing Pin
leon de boer13-Sep-18 0:47
memberleon de boer13-Sep-18 0:47 
GeneralRe: The mismatch between Print preview and the real printing Pin
Member 1388734913-Sep-18 3:18
memberMember 1388734913-Sep-18 3:18 
GeneralRe: The mismatch between Print preview and the real printing Pin
leon de boer13-Sep-18 5:29
memberleon de boer13-Sep-18 5:29 
QuestionThread synchronization problem Pin
samzcs10-Sep-18 9:12
membersamzcs10-Sep-18 9:12 
AnswerRe: Thread synchronization problem Pin
Richard Andrew x6410-Sep-18 9:35
professionalRichard Andrew x6410-Sep-18 9:35 
GeneralRe: Thread synchronization problem Pin
samzcs10-Sep-18 10:09
membersamzcs10-Sep-18 10:09 
GeneralRe: Thread synchronization problem Pin
Richard Andrew x6410-Sep-18 10:11
professionalRichard Andrew x6410-Sep-18 10:11 
GeneralRe: Thread synchronization problem Pin
samzcs10-Sep-18 10:28
membersamzcs10-Sep-18 10:28 
QuestionRe: Thread synchronization problem Pin
CPallini10-Sep-18 21:02
mveCPallini10-Sep-18 21:02 
AnswerRe: Thread synchronization problem Pin
samzcs11-Sep-18 2:45
membersamzcs11-Sep-18 2:45 
GeneralRe: Thread synchronization problem Pin
CPallini11-Sep-18 3:23
mveCPallini11-Sep-18 3:23 
AnswerRe: Thread synchronization problem Pin
leon de boer10-Sep-18 22:08
memberleon de boer10-Sep-18 22:08 
GeneralRe: Thread synchronization problem Pin
samzcs11-Sep-18 2:50
membersamzcs11-Sep-18 2:50 
GeneralRe: Thread synchronization problem Pin
leon de boer11-Sep-18 5:05
memberleon de boer11-Sep-18 5:05 
GeneralRe: Thread synchronization problem Pin
11917640 Member 11-Sep-18 19:53
member11917640 Member 11-Sep-18 19:53 
GeneralRe: Thread synchronization problem Pin
samzcs12-Sep-18 8:12
membersamzcs12-Sep-18 8: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.