Dlg rc 2 CWindow

Started by James Fuller, June 24, 2016, 10:17:48 AM

Previous topic - Next topic

James Fuller

Jose,
  I am exploring a 64bit static build of pcre.
I am parsing a Dialog resource (.rc) script that I want to convert to CWindow. What would be the best approach to convert the Dialog Units to pixels?

James

José Roca

You have to use the MapDialogRect function: https://msdn.microsoft.com/en-us/library/ms645502(v=VS.85).aspx

But you need first to create a dialog that uses the wanted font to pass its handle to the function, because it needs to know the font size in order to perform the conversion.

There is also the function GetDialogBaseUnits: https://msdn.microsoft.com/en-us/library/ms645475

But it uses the system font, and nobody uses the system font any more. Well, perhaps one or two old farts, but nobody else.

And this article in Microsoft Knowledge Base:
https://support.microsoft.com/es-es/kb/125681

James Fuller

Thanks Jose that jogged my memory a bit so I went-a-code-searchin' ; and surprise! surprise! I found Fb code from 2007 that implemented my runtime dialogs converted from my original Pb version (pre DDT). Made a few alterations for 64bit and away we go!!

James