Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

OWL and translations

0 views
Skip to first unread message

Dale Shuman

unread,
Nov 27, 1998, 3:00:00 AM11/27/98
to
Hello,

I am in the process of doing a version of an app in another language.
We have stringtabled all text and so forth, but one small detail is how
to load an alternative menu. I want to have all of the
language-specific items in language-specific DLLs, but the OWL menu
stuff always seems to use GetModule() to access the menu resource, which
means it assumes that the menu resources will always be in the exe file,
not the dll.

I am setting the text for the menus at runtime from a stringtable in the
DLL, but I lose the ability to use the RW to maintain the menus. It's
working just fine, but seems less than elegant, and I though perhaps
someone had figured out a solution.

Regards,
Dale Shuman

--
Who knows what evil lurks in the hearts of CPUs. . . ?

Tracy Snyder Walder

unread,
Dec 8, 1998, 3:00:00 AM12/8/98
to
I am working on a project that handles several different languages via a
resource DLL, this is the essence of how it is supported in my project:

1. Create a DLL that consists only of the resources for a language (string
tables,
dialogs, menus, etc.). Create a new OWL DLL target for each language. I'm
assuming
you know the IDE well enough to set all this up; you'll want to share common

*.rh files among the various language resource DLLs.

2. In the class that you have derived from TApplication, use TModule to load

the desired DLL. You need to save the pointer so you can delete the TModule
later, and access the member functions in TModule.

3. Use the TModule member function LoadMenu to load the menu. Some code
snippets are shown below (you'll want to add some error checking/exception
handling). I did run across some OWL bugs in TModule exception handling last

summer, search dejanews on "TModule exception handling" for some
workarounds.


class TMyApp : public TApplication
{
public:
// Constructor
TMyApp()
{
module = NULL;
menu = NULL;
}

// Destructor
~TMyApp()
{
if ( menu )
delete menu;

if ( module )
delete module;
}

...

public:
bool SetLanguage( char *lang_dll );
bool LoadMenu();

private:
TModule *module;
TMenu *menu;
...
};


// Call this function with the filename of the language DLL created in step
1.
bool TMyApp::SetLanguage( char *dll_name )
{
if ( module )
delete module;

module = new TModule( dll_name );
if (module == NULL )
return false;

// Call member function to load the main menu
return ( SetMenu() );
}

bool TMyApp::SetMenu()
{
if ( menu )
delete menu;

// Load the menu MAIN_MENU from the language DLL
menu = new TMenu( module->LoadMenu( MAIN_MENU ), NoAutoDelete );
if ( menu == NULL )
return false;

return true;

Tracy Snyder Walder

unread,
Dec 8, 1998, 3:00:00 AM12/8/98
to
0 new messages