Filtering resource texts in dialogs and menus
Hello,
is there a way to make an MFC application (dialog, SDI or MDI) filter
the strings it loads from resources (dialogs, menus etc.) through a
function in the application? I want to do text replacements, like
replace "article number" by "part number" or similar, throughout
the application without having to modify the resource file or use
multiple resource DLLs (as in the common internationalization concepts).
Just for illustration, I came up with the following function:
void Reverse(CDialog &Dlg)
{
for(CWnd *wnd=Dlg.GetWindow(GW_CHILD);wnd!=NULL;wnd=wnd->GetWindow
(GW_HWNDNEXT))
{
CString Str;
wnd->GetWindowText(Str);
if (Str.IsEmpty())
continue;
string Text(Str);
reverse(Text.begin(),Text.end());
wnd->SetWindowText(Text.c_str());
}
}
Put "Reverse(*this);" at the end of a dialog's OnInitDialog function,
and all texts (in static and button controls) will be reversed. This is
a good step towards what I'm trying to do, but I'd like this:
- to work with all dialogs without having to modify each single one
- to work with additional texts in the dialog, like property page titles
- to work with other resource types, like menus and strings
Any idea how to do it? Is it possible?
Thanks for any help
W. R?sler