Designing a GUI with a Visual Editor

I dislike Visual Studio, but want to make a GUI application. I used to use ResEdit to design GUIs, but whenever I use the units (that come up in the C++ code example) in Code::Blocks (bare C++ code), the compiled GUI runs, but the controls are all out of whack. Do I have to convert pixels to device units or something?
Other way round. ResEdit uses Device Coordinates to create the dialogues, so they will need to be converted to pixels (which C uses within creating the Dialogues by hand). However, it is normally much easier to simply use the resource files generated by ResEdit and include that within your project, and then simply create the dialogues from those resources.
But on MSDN the width and height parameters of CreateWindowEx() say it needs to be in "Device Units". Is the explanation wrong or am I missing something?
Dialog templates use dialog units (or dialog box units or DLU) not device units.

Device units are (at least usually) just pixels.

There are now also Device Independent Units (or Device Independent Pixels) which are used by WPF, which was introduced to handle different screen resolutions consistently.

And GDI (etc) work with logical units, which depend on the mapping mode. If the mapping mode is the default MM_TEXT mode then there is no scaling and the logical units are device units.


How to calculate dialog box units based on the current font in Visual C++

Device Independent Units to Points to Inches

SetMapMode function
Last edited on
closed account (Dy7SLyTq)
personally i like using qt because its cross platform and qt creator brings a nice balance between interface design and still being able to write the code (the linux build can be quite slow though (even the generated elf/exe) imo)

So in order to properly use the coordinates from ResEdit, I'd have to pass MM_TEXT to SetMapMode() and then pass the ResEdit coords to the CreateWindowEx() function?
And what if I were to use NetBeans' GUI designing tool, then port the coords to WinAPI code?
Topic archived. No new replies allowed.