Dialog into a DLL

Started by Rudolf Furstauer, February 17, 2012, 01:18:05 PM

Previous topic - Next topic

José Roca

It was something that I had in the ToDo list because I had not enough information about it. Besides, I only have Windows 7 and a modest computer and monitor.

GDI has became inadequate because it was designed when practically all monitors used 96 DPI and all the applications looked the same in almost all systems. Now, if you use a high resolution monitor, you have to increase the DPI because otherwise the text is unreadable. But this doesn't increase the size of the pixels; otherwise you will lose resolution. For legacy applications, M$ had the idea of virtualization, that is what you get when your program is not DPI aware. It first renders the entire application window to an internal bitmap using 96 DPI sizes, and then scales up that bitmap to the current DPI setting before putting it on the screen. But this is just a workaround with many problems.

System fonts still exist for backward compatibility, but are of no use with DPI aware applications beause don't have enough resolution. The new fonts don't auto scale, therefore you have to scale them when you create them. Images an graphics also don't auto scale, so an icon, for example, looks much smaller in a high resolution monitor. You have to stretch them, with loss of quality, or have the same icon in several sizes and choose the most appropiate one at runtime depending of the resolution and DPI.

In the CWindow class I have added several methods such GetWindowRect, GetClientRect Width, Heigh, ClientWidth, ClientHeight, etc., but obviously I can't wrap the entire GDI. M$ can put 200 or 300 programmers to do the task, but I'm a man alone and with scarce information and little resources. As we say in Spain, "El qe hace lo que puede, no está obligado a más." ("No one is bound to do the impossible.")

José Roca

Chris Boss is always talking about his EZGUI engine and how he has chosen carefully the API functions that work in all versions of Windows, and blah, blah, blah. He is a good programmer, but he is using methods of the dark ages. I once told him that in his quest for backward compatibility he was neglecting forward compatibility. I took one of his tools and make it to look horrible and almost completely unusable with just selecting in my computer the Windows 7 Basic Theme and 145% DPI. Among several other things, the fonts looked fuzzy and over sized, not fitting in the controls.

Today's applications must support high-quality text rendering, resolution-independent outline fonts, and full Unicode text and layout support. For this you need DirectWrite, a new DirectX API, but as it is only available in Windows 7, Windows Vista with Service Pack 2 (SP2) and Platform Update for Windows Vista, Windows Server 2008 R2 or Windows Server 2008 with Service Pack 2 (SP2) and Platform Update for Windows Server 2008, and also requres knowledge of low-level COM programing, I can only use it for my own tests. Anyway, my headers are ready to use it.