Page 1 of 1
Posted: Fri Mar 22, 2002 6:10 pm
by BackupUser
Restored from previous forum. Originally posted by tinman.
Hi,
I'm trying to get the vertical DPI of the windows desktop. ATM I'm
trying code like this:
hdc = GetDC_(GetDesktopWindow_())
If hdc
vdpi.l = GetDeviceCaps_(hdc, #LOGPIXELSY)
ReleaseDC_(GetDesktopWindow_(),hdc)
EndIf
But it returns 0 all the time. I guess I'm using the wrong thing to
get the vertical DPI. Any hints?
Thanks.
--
It's not minimalist - I'm increasing efficiency by reducing input effort.
Posted: Fri Mar 22, 2002 6:47 pm
by BackupUser
Restored from previous forum. Originally posted by Paul.
What OS are you using??
I just tried your code under Win2K and it works fine!
Posted: Fri Mar 22, 2002 8:18 pm
by BackupUser
Restored from previous forum. Originally posted by tinman.
What OS are you using??
I just tried your code under Win2K and it works fine!
Win95 (the code was from the Win95 dev docs too

.
OK, perhaps there is something else in my code interfering, or maybe I typed it wrong in the editor and correctly on here
Any case, thanks for testing it and letting me know it works!
--
It's not minimalist - I'm increasing efficiency by reducing input effort.
Posted: Fri Mar 22, 2002 8:19 pm
by BackupUser
Restored from previous forum. Originally posted by Franco.
It works also on Win98SE. I got a value of 96.
BTW: What is this anyway? DPI value on the desktop?
How can Windows know about that?
Does the Monitor tells Windows: "Hey Buddy, I'm a 21" Monitor" ?
If so, with the resolution info the OS can calculate the theoratic dpi.
And what can I do as programmer knowing the dpi instead of the screen resolution?
OK, I can calculate the size of the monitor by my own, but whatelse?
Have a nice day...
Franco
Sometimes you have to go a lonely way to accomplish genius things.
Edited by - franco on 22 March 2002 20:22:05
Posted: Fri Mar 22, 2002 8:55 pm
by BackupUser
Restored from previous forum. Originally posted by tinman.
BTW: What is this anyway? DPI value on the desktop?
How can Windows know about that?
Does the Monitor tells Windows: "Hey Buddy, I'm a 21" Monitor" ?
If so, with the resolution info the OS can calculate the theoratic dpi.
And what can I do as programmer knowing the dpi instead of the screen resolution?
Thanks for testing it. Seems I need to slap my computer a bit then
I'm using it for font sizes. I've got some code and it always returns the wrong size for the font, but if I get this then I can calculate the pixel size from the known "em" size (specified in 1/72th of an inch).
It's basically the DPI value shown for the font on the "Settings" tab of the Display properties.
--
It's not minimalist - I'm increasing efficiency by reducing input effort.
Posted: Fri Mar 22, 2002 9:02 pm
by BackupUser
Restored from previous forum. Originally posted by Franco.
Thanks for lighten me up
Have a nice day...
Franco
Sometimes you have to go a lonely way to accomplish genius things.