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.
Windows Desktop stuff
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by tinman.
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.
Win95 (the code was from the Win95 dev docs too .What OS are you using??
I just tried your code under Win2K and it works fine!
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.
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
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
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
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by tinman.
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.
Thanks for testing it. Seems I need to slap my computer a bit thenBTW: 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?
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.
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm