Thomas Olsson

I have a wierd problem.

Our application, written in MFC, uses an ActiveX control, also written in MFC (VS2005SP1).

If I change the DPI to 144 on WinXP our app handles this fine and everything is scaled as expected.

If I change the DPI on Vista and also check the "Use Windows XP style DPI scaling" it also works fine.

If I change the DPI on Vista and do not check the "Use Windows XP style DPI scaling" our application was initially scaled by Vista and worked as expected.

So far so good.

Now we would like our application to look nicer and use the real DPI. To accomplish this we call SetProcessDPIAware() when the process starts (first in InitInstance). Then Vista no longer use the automatic scaling for our application and the application see the "true" DPI. This works almost fine. The strange thing is that our ActiveX control does not get the higher DPI! How can this be The control works as expected with high dpi on WinXP and Vista "XP mode". But in our app that is "DPI aware" everythings get high DPI except the control!

How can this be Are there any special treatment of ActiveX controls

/Thomas



Re: UI Development for Windows Vista Special treatment of ActiveX controls in Vista high DPI mode?

Thomas Olsson

We have solved this problem now!

Our application calls SetProcessDPIAware() the first thing we do in InitInstance() (called by MFC when the application is started).

It turns out that this is not early enough though! Actually, there is no way you can call it early enough in an MFC application. The problem is that MFC gathers some system metrics in a static class (afxdata) and they do this from the constructor. The constructor is thus called when the DLL is loaded and there is no way we can call SetProcessDPIAware() before this.

We have made a workaround to this problem by sending a WM_SETTINGCHANGE message to the main application window directly after it has been created. That triggers MFC to reload the system metrics.

What about the rumor that you can specify you app as DPI aware in the manifest This would be a much better solution, but I cannot find any documentation for this. (Actually I cannot find any documentation about the new manifest settings, such as requestedExecutionLevel, in Vista)

/Thomas





Re: UI Development for Windows Vista Special treatment of ActiveX controls in Vista high DPI mode?

Ted.

Raymond Chen's new book - page 467 (please remove if this is a copyright violation)

<asmv3:application

xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">

<asmv3:windowsSettings

xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">

<dpiAware>true</dpiAware>

</asmv3:windowsSettings>

</asmv3:application>

 

 





Re: UI Development for Windows Vista Special treatment of ActiveX controls in Vista high DPI mode?

Thomas Olsson

Thanx for that info! I will try that.

His book is obviously the only place where you can find this info and even Raymond doesn't know where he got it from...

See the comments on his blog entry here.

/Thomas





Re: UI Development for Windows Vista Special treatment of ActiveX controls in Vista high DPI mode?

Thomas Olsson

I have nowe confirmed that the Raymond manifest "hack" actually works.

It feels a bit strange to use his book as the only source of this information...

/Thomas





Re: UI Development for Windows Vista Special treatment of ActiveX controls in Vista high DPI mode?

Ted.

Yes, I wonder what other windowsSettings exist.



Re: UI Development for Windows Vista Special treatment of ActiveX controls in Vista high DPI mode?

Ted.

it's nice to see the official MSDN documentation updated with info on this manifest info, as well as a warning to use the manifest approach instead of SetProcessDPIAware:

http://msdn2.microsoft.com/en-us/library/ms633543.aspx