We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now


Again: AfxSetResourceHandle() and non modal dialog boxes

atari asked
Medium Priority
Last Modified: 2013-11-20
Hi, I post this question again, because you cannot login to the old question !!!

Question was:
In my program I can load dynamically by clicking some selfmade menu entries in menu an extern resource dll for updating my menus and dialog boxes to a foreign language. Everything works great, all the updating of menus, tooltips, dialog boxes and so on. I call AfxSetResourceHandle(languagedll) after loading my language dll. But if there is a non modal dialog box displayed, how can I refresh this dialog box to switch to the loaded language without destroying the dialog box and displaying it again ?

Is there any possibility to do so ?
Thanks a lot.
Watch Question

I don't think it is possible.
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Oops I forgot to check the e-mail notification box! There...


Whom shall I believe now, chensu with so much points or danyell ? I think, that is the limit of AfxSetResourceHandle(), the only choice is to save the settings of your dialogbox in some local variables, then destroy the dialog box and create it again and put all the settings back. Yes, you could give an ID to every item in the dialog box, but there are a lot of IDC_STATICS.

Reduce points, because I believe, what chensu said.


First, don't have blind faith in my points. Nobody is proficient in every area. I might be wrong.

Regarding danyell's solution, I am wondering how to get the resource for each control in the dialog box and recreate it according to the resource. I would say that is very tough if possible. It seems that I am talking about each dialog box with a dialog template while danyell is saying each control in a dialog box is responsible for its own resources. And the layout (each control's position and size) of a dialog box in one language might be different from the one in another language.


Think, we don't get any answer any more, because I spend the points, and the problem was, that I could not reduce the points. Sorry, I would have given the points to you, but then I had to give the question free for others to answer, but in between I discussed to some other with the above problem, and they also said, that there is no solution for it. So I wanted to free the question from discussion-board.

Thanks, chensu

I seem to remember an MS knowledgebase article on this subject, regarding resource-management techniques for localization. The broader question atari is asking, in a way, is about using dynamic dialog boxes combined with resource templates.

chensu makes a good point about layout potentially changing from one language/locale to another. A better way to address the broader issue, perhaps, is to develop a custom MFC class for the client area of the dialog-box window. You may also consider creating your own window class that *simulates* modeless dialog boxes as far as persistence, z-order and other features go, but would still in fact be regular windows with regular message-pump access in every other respect. This is not absolutely necessary but I'm guessing it would simplify code overall if you choose to implement the custom client-area window class.

I actually used the above technique on a video editing application with a complex GUI, with considerable success.

As far as knowledge goes, it is clear that chensu is very qualified, however his points on this site prove only that chensu has been active on experts-exchange.com longer than I have. I only started using this site 3 days ago! But, I have been developing MFC apps since MS C 6.0 -- that's the version before Visual C++ 1.0. So, I'm sorry I couldn't help more in this case, but for your own benefit you should try not to jump to conclusions about people's expertise based solely on their points in this system.

If you really don't want to destroy the dialog box and recreate it, danyell's solution is very good for you.

>however his points on this site prove only that chensu has been active on experts-exchange.com longer than I have.

Yes, I think so. I always think that the points system is unfair for newcomers. But as long as you insist on it, you will be the top one.

>I have been developing MFC apps since MS C 6.0 -- that's the version before Visual C++ 1.0.

Microsoft C 6.0 didn't come with MFC, it was a C compiler not C++ compiler. What you wanted to say is Microsoft C/C++ 7.0, which came with MFC 1.0.

>for your own benefit you should try not to jump to conclusions about people's expertise based solely on their points in this system.

I fully agree.


Haven't seen that the discussion is going on. Where it all started was the codeguru-website. There is an interesting sample program called 'scribble multilanguage'. So far we had written our resource-dll's and could switch only at program start to the desired language by reading a flag somewhere in the .ini-file. Implementing parts of the above example I was possible to switch dynamically by selecting a menu entry to the desired language. But the problems occured afterwards, because the above example wasn't complete. I came to the problem with non modal dialog boxes. And because the texts for example in English are sometimes shorter than for example texts in German (my home country) it isn't so simple only to change all the texts in dialog box, you have also update the positions of all texts, therefore the resource-template of the dialog box taken from the language dll. I have only 1 year experience with mfc, the above discussion was on a very high level, but very theoretically for a beginner, so where can I find any example for a 'custom client-area window class', or how can I write my own class for simulating modal dialogboxes. Are there any examples on the internet available ? It sounds very hard, maybe so hard as to subclass the CFileDialog for implementing image-previews or inserting own controls.

>for your own benefit you should try not to jump to conclusions about people's expertise based
   solely on their points in this system.

I think, I should, because it seems to me very logically, the lot of points are resulting not from nowhere. But I think you could also have experience in programming if you don't have so much points. Look at me, I'm a newcomer to mfc, but I have over 10 years programming experience in writing technical software for a company.

The customer are very unfair, because a lot of them don't grade the answers, that were given. And it is allowed to look inside all the locked answers for free, so it is possible to get good answers for free. Also you have only a choice to get much points, if you are online for a lot of time and not only for a few hours.

Thanks so far,
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.