Sign in to follow this  

How do I calculate width&height with dpi in win32

This topic is 1418 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
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

This topic is 1418 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this