You can use :
dpiX = (FLOAT)GetDpiForWindow(GetDesktopWindow());
dpiY = dpiX;
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi all,
I'm using windows 10 pro with VS2019 comm.
I'm a noob at win32api stuff. I can do more with c# and .net (WPF) but I'm not a software developer. I was trying to follow the example for direct2d in this link:
https://learn.microsoft.com/en-us/windows/win32/direct2d/direct2d-quickstart
After I managed to figure out where to place the code, I compiled it and I get this error:
Error C4996 'ID2D1Factory::GetDesktopDpi': Deprecated. Use DisplayInformation::LogicalDpi for Windows Store Apps or GetDpiForWindow for desktop apps.
at this line: m_pDirect2dFactory->GetDesktopDpi(&dpiX, &dpiY);
I understand the error but I don't understand the suggested solution. This is not for the windows store (I think) so I need to use GetDpiForWindow. Here is the link for GetDpiForWindow:
https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdpiforwindow
The arguments are not the same as ID2D1Factory::GetDesktopDpi so I'm baffled. Any help is appreciated.
Thanks
You can use :
dpiX = (FLOAT)GetDpiForWindow(GetDesktopWindow());
dpiY = dpiX;