
dynamically build dialog box
Writing a generic about box is quite simple; in fact, I have a DDJ
article about it! Also, read my essay about subclassing dialog boxes.
Note that neither of these require constructing a template. Likewise
for internationalization; you don't have to construct the template in
memory; you can just set the strings you want, or clone the dialog,
either one. For example, if you put the strings in a DLL with the same
IDs as the controls, then a simple loop which iterates over the child
controls, doing a LoadString based on the dialog control ID, can
locate all the strings that need to be substituted (any control which
doesn't need substitution won't have a corresponding string).
joe
On Sun, 21 Jan 2001 12:08:45 -0000, "Martin Knott"
Quote:
>first, thanks for your and the other replies.
>i have about 20 applications that have been developed separately using "cut
>and paste" development. this means there's lots of scope for factoring
>common code into classes and reusing these classes in each application. one
>of the classes that's replicated is the aboutbox. i realise that i could
>create one CMyAbout class and reuse this in all the aps. i also considered
>building it in memory though, since it's quite a simple class and there's no
>complicated user interaction needed except having it close when the ok
>button is pushed. this way the whole class is hidden from view and the apps
>seem less complicated (marginally). i tried to use some code i got off the
>web and it didn't work. the other poster has pointed me toward another
>example which i wil try out later.
>My reluctance to go down 'normal' route involving a dialog template and a
>class htat calls it relates to a previous post of mine which has gone
>unanswered. the other post relates to multi-language support. if you don't
>mind, i'll re ask here because i've got some nagging doubts that i'm going
>about it the wrong way which perhaps a fresh mindset might spot where:
>POST BEGINS
>subject: multi language support
>i want to implement an app in variuos languages. so, i extracted all the
>literals to a string table then copied this to several DLL projects, one for
>each language. (then someone else translated them!) so, on app start i can
>use afxsetresourcehandle to the right dll and the strings load fine using
>mystring.loadstring(IDS_MYVALUE).
>the problem is that as well as string resources, my project has other
>resources that are not language dependent, for example bitmaps, icons and
>dialogs. i'm faced with the following dillema. i can either:
>1) make copies of the dialogs and place them in the same dll resource. this
>means maintenance will be irksome becuase even minor cosmetic changes will
>require changing x dialogs (x being num of languages)
>2) i can keep the dialogs in the main aps' resources, declare another
>resource handle
>and swap back and forth between local resources and main resources at
>runtime. this means introducing more code and constantly having to think
>"which resources do i need for the following action?"
>is there a good turorial on the web to give advice on such matters?
>thanks in advance
>martin
>POST ENDS
>I'm heading down route 2 at the moment and although i haven't hit any major
>problems, i can't believe that there isn't more support for this kind of
>things in vccp.
>any thoughts would be much appreciated. also could you send them to:
>much obliged,
>martin
>> Joseph M. Newcomer [MVP]
>> Web: http://www3.pgh.net/~newcomer
>> MVP Tips: http://www3.pgh.net/~newcomer/mvp_tips.htm
Joseph M. Newcomer [MVP]
Web: http://www3.pgh.net/~newcomer
MVP Tips: http://www3.pgh.net/~newcomer/mvp_tips.htm