Jump to content
Site Stability Read more... ×
  • Advertisement
Sign in to follow this  
noatom

How do I calculate width&height with dpi in win32

This topic is 2061 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So I want to create a tab control in a window,but the CreateWindow function in win32 expect me to send the width&height in device coords...

I know the screen coords size(480x800),but I have no ideea how to convert that.

 

I tried with: LPtoDP() but after the call it doesn't change the point structure so it still leaves me with (480x800)....

 

Share this post


Link to post
Share on other sites
Advertisement
You can use

double ratio = GetDeviceCaps(myhdc, LOGPIXELSX) / 96.0;

And then multiply your pixel values with that.

Share this post


Link to post
Share on other sites
Then perhaps you need to tell Windows that your application is DPI
aware, you can do that either via a manifest or by simply calling SetProcessDPIAware.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!