CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    May 1999
    Posts
    318

    Changing resources


    I have to implement multi language program.
    My idea is to have several resources files with each resource duplicated with the same id (one for each language).

    But how could I dynamically change the used resources file in my program ?



  2. #2
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Changing resources

    Check out LoadLibrary(), FreeLibrary()

    Regards,

    Paul McKenzie


  3. #3
    Guest

    Re: Changing resources

    I have found success by creating resource only DLLs, one for each language to be supported.

    In the "static" case, load the appropriate resource DLL in your apps InitInstance method. The code would look something like:
    m_hResDLL = LoadLibrary( "LanguageResource.DLL" );
    AfxSetResourceHandle( m_hResDLL );

    In the "dynamic" case, you could add a menu to allow the user to select the language and free the previous resource DLL and load a new one. I have never done this, so I don't know if there are any problems forcing everything to be repainted in the new language.

    - Rich Bietz


  4. #4
    Join Date
    May 1999
    Posts
    318

    Re: Changing resources

    Ok fine. The solution seems to be the correct one.

    But could you shortly explain how to develop a resources DLL (just the main steps to make and build one using mfc) ?

    Thansk for all.



  5. #5
    Join Date
    May 1999
    Posts
    318

    Re: Changing resources

    Ok fine. The solution seems to be the correct one.

    But could you shortly explain how to develop a resources DLL (just the main steps to make and build one using mfc) ?

    Thansk for all.




  6. #6
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Changing resources

    Create an empty DLL project and just edit the resources by adding your strings. Make sure that the ID's you give the strings match the ID's in your other resource DLL's. Then build the DLL, and you should be Ok.

    The VC on-line help has more info on how to do this.

    Regards,

    Paul McKenzie


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured