Currently, TDialogRes is incomplete, buggy [bugs:#593] and not fit for purpose.
It would be nice to have full parsing of the binary template (DLGTEMPLATE or DLGTEMPLATEEX) and member functions to query and update any part of it. For example, this would allow us to do simple font substitution.
See [discussion:8181d4c0c7#e71a].
Also see discussion in "TResource::GetSize function" [feature-requests:#132].
Bugs: #593
Discussion: How to change the font of a TDialog
Feature Requests: #132
Anonymous
Great idea! This class seems to be an incomplete implementation leftover from BC5.02/OWL5 days and not touched since.
A series of posts about dialog templates from Raymon Chen's blog:
The evolution of dialog templates – Introduction
The evolution of dialog templates – 16-bit Classic Templates
The evolution of dialog templates – 32-bit Classic Templates
The evolution of dialog templates – 16-bit Extended Templates
The evolution of dialog templates – 32-bit Extended Templates
The evolution of dialog templates – Summary
Hi @jogybl,
Curious to check out your latest changes to modernise the OWLNext code base, I did a build test of the trunk, and while clicking through on some new warnings, I stumbled upon an issue with TDialogRes::GetText.
After your recent refactoring [r8657], the first part of the function no longer does anything useful, and your new code uses _tcsncpy, which (among other issues) may truncate without null-termination.
Tip: Never use strncpy. The C++ standard library now has safer alternatives. If you want to allow truncation, use std::strncpy_s, or if not, use std::strcpy_s (and explicit truncation error handling).
Possible fix, allowing truncation:
Related
Commit: [r8657]
Last edit: Vidar Hasfjord 2026-03-30
Hi,
This function is now totally redundant and is marked as deprecated. I am going to simply remove it in the near future, as I don't think anyone has been using it - considering the whole class was broken since forever.
@jogybl wrote:
Makes sense. Still, I learned something today (after hours discussing C++ standard behaviour with Copilot): Don't use a reference declaration and ternary expression together for selective binding. It is too easy to have an unintentional temporary generated. For such selective binding, use an explicit pointer instead.
https://gcc.godbolt.org/z/5sx9K9qrv
With the changes in [r8737] the overhaul of the TDialogRes class is done for now.
The class correctly handles both classic and extended templates and also retrieves the list of controls in the templates, as demonstrated in the new TDialogResTest example in the Classes project.
In the future, if requested, functions for manipulating the templates can be added.
Related
Commit: [r8737]
After the overhaul to implement support for extended dialog templates [bugs:#593], here is a patch with some further clean-up you might consider:
Related
Bugs: #593
Last edit: Vidar Hasfjord 2026-04-08
Diff:
Related
Discussion: How to change the font of a TDialog
Feature Requests:
#132