It is currently Sat Jul 11, 2020 4:19 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject:
PostPosted: Fri Mar 22, 2002 6:10 pm 
Offline
PureBasic Guru
PureBasic Guru

Joined: Tue Apr 22, 2003 7:42 pm
Posts: 16777133
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.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Mar 22, 2002 6:47 pm 
Offline
PureBasic Guru
PureBasic Guru

Joined: Tue Apr 22, 2003 7:42 pm
Posts: 16777133
Restored from previous forum. Originally posted by Paul.

What OS are you using??

I just tried your code under Win2K and it works fine!


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Mar 22, 2002 8:18 pm 
Offline
PureBasic Guru
PureBasic Guru

Joined: Tue Apr 22, 2003 7:42 pm
Posts: 16777133
Restored from previous forum. Originally posted by tinman.

Quote:
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.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Mar 22, 2002 8:19 pm 
Offline
PureBasic Guru
PureBasic Guru

Joined: Tue Apr 22, 2003 7:42 pm
Posts: 16777133
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


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Mar 22, 2002 8:55 pm 
Offline
PureBasic Guru
PureBasic Guru

Joined: Tue Apr 22, 2003 7:42 pm
Posts: 16777133
Restored from previous forum. Originally posted by tinman.

Quote:
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.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Mar 22, 2002 9:02 pm 
Offline
PureBasic Guru
PureBasic Guru

Joined: Tue Apr 22, 2003 7:42 pm
Posts: 16777133
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.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye