0

We have a COM server DLL written in Delphi 7 that is used from a VCL application written in XE2.

On a Microsoft Surface Book, with a resolution of 3000x2000, the XE2 application starts fine and is scaled normally, but when the user clicks the option that causes the COM DLL to be used, the main form suddenly shrinks to half its size, along with the text and controls.

We have a related Delphi 7 VCL application that had the same problem but we now include a custom manifest that specifically states that DPIAware is false. This works fine on the Surface Book. We tried the same technique on the COM DLL but it has no effect.

We can get the XE2 program to scale correctly with our Delphi 7 COM DLL if we have the registry value for preferring external manifests and include a manifest file with the XE2 application. However, it also executes another XE2 application from within using WinExec, and this second XE2 application then scales badly. Including a manifest for the second XE2 app has no effect unless run directly and not from within the first XE2 app.

Strangely, or not, if we build a COM server in XE2 it always scales properly in high DPI situations, even without a custom manifest, so we are currently trying to convert the Delphi 7 DLL to XE2 but it's a lot of work as there are a number of legacy component packages that are no longer available for XE2.

Please note that the XE2 application scales small as soon as the CoCreate is called for the COM server. It does not scale back to its original size when the COM server is freed.

Does anyone have any ideas on how to get the Delphi 7 DLL to report to Windows that it is not DPI aware so that other non-DPI aware applications using it don't suddenly scale incorrectly?

SiBrit
  • 1,460
  • 12
  • 39
  • I've now read that the workaround of having an external manifest and altering the registry has been patched out by the latest service pack for Windows 10. – SiBrit Sep 18 '16 at 20:45
  • We are progressing with the XE2 conversion of the Delphi 7 COM server DLL, although now technically it is RAD Studio 10.1 Berlin, but we've also had an influx of new users with high DPI devices who are unable to properly use the 2 applications together because of this scaling issue, so any pointers would be welcome. – SiBrit Sep 18 '16 at 20:49

1 Answers1

0

I had a similar issue with VB6 Exe and .Net Com Interop Dll (both not DPI aware). On displays with high DPI setting, suddenly window size changed.
This workaround solved it: I set compatibility setting of exe 'Disable display scaling on high DPI settings'.

migeold
  • 1
  • 2
  • While I can create a manual manifest and include it with a Delphi 7 EXE in order for it to report that it is not High DPI Aware, and therefore will scale properly on newer devices, it is not possible to do this with a Delphi 7 DLL. At least, not to my knowledge, hence the question to SO. – SiBrit Dec 04 '16 at 20:23