How do I calculate width&height with dpi in win32

Started by
3 comments, last by noatom 10 years, 1 month ago

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)....

Advertisement
You can use

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

And then multiply your pixel values with that.

i get ratio = 1??

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.

that worked

This topic is closed to new replies.

Advertisement