language resource dll and MFC
Mats Mеnhav -- manhav@connectum.skurup.se
Friday, June 28, 1996
-- [ From: Mats Manhav * EMC.Ver #2.5.02 ] --
Env: MSVC 4.1 Win 95 / Win 4.0
I am building an MFC application.
This application is gonna be localized for 7 languages.
To make only one exe file, I would like the resources to be placed in a dll.
The correct dll should be loaded depending on what language want to use.
This requires that I put all the resources within a DLL.
I have not found any documentation on how to make a resource only dll for
MFC.
Anyone can help me ?
mats
--
==========================================================================
Mats Mеnhav (Mats Manhav for 7-bit people)
email:manhav@connectum.skurup.se WWW: http://connectum.skurup.se/~manhav
FAX: (int) 46 (0) 414 243 05 Phone: (int) 46 (0) 414 243 05
==========================================================================
Kevin_L_McCarthy.IACNET@ngate.zis.ziff.com
Monday, July 01, 1996
[Mini-digest: 5 responses]
A search on MSDN for "internationalization" yields:
MSJ 1994 June, July, and Dec.
MSJ 1995 April.
See also TechNote 057 (from MFC 4.0 doc)
and KB article Q100390.
I haven't actually tried to adapt this stuff to my application yet, but it is
on the to-do list. These article look like they would apply.
-----From: Bharat Gogia
What we did for making biligual (Arabic / English) app. is this:
1. Remove all the resources from Applocation RC (except Afx resources
and main frame).
2. Create two different RC files one with english resource and the other
with arabic resources. Make sure that resource IDs are same in both
RC (basically use same names and values as for resource.h.
3. Create two dll applications blank apps (i.e.only with LibMain), in
one add english RC and in other add Arabic RC.
4. At run time depending on which resource you want use load the
respective DLL (i.e. on with English or Arabic). Set the Resource
handle in CWinApp to the corresponding dll.
5. Make sure to delete all resources (including main menu) and unload
the previous dll while changing the language resource on the fly.
Allow user to chnage the language when you have least resource on the
screen, say when you have only main frame. DON'T DELETE
MAINFRAME, just replace menu and title.
Hope this helps.
-----From: funduc@sprynet.com
Hi,
I've done that once with the 1.52 compiler but it should work for 4.0 too. You
need to create a resource-only DLL with your strings, dialogs etc in it, then
load it into your App::InitInstance by calling
AfxSetResourceHandle(hInstResource); with the DLL's instance handle
as early as possible so that error messages are loaded from the DLL.
To create a resource-only DLL, all you should need is the RC and resource.h. A
default LibMain/DllMain(for 4.x) may be needed in a .c or .CPP file. The DLL
does not need any fancy MFC CWinApp derived code. It can be C only.
-----From: "Richard A. Nichols"
Hi Mats!
{MSVC 4.1 WinNT 4.0 (Beta2) }
The Win32 SDK has RESDLL here is the MSDN description:
The RESDLL sample shows how to create a resource-only dynamic link library
(DLL). This is accomplished by creating and resource-compiling a resource
(.RC) file, and then linking it correctly.
RESDLL includes two makefiles. The first, THE_DLL.MAK, builds
THE_DLL.DLL. The second, MAIN.MAK, builds the test application. You must
build the .DLL file before building the .EXE file.
The MAIN.EXE program tests THE_DLL.DLL by loading it and referencing the
DLL's icon, cursor, and bitmap. The icon and cursor are used by the
registered window class, and the bitmap is used in painting the client
area.
RESDLL is a Microsoft(R) Win32(R) Software Development Kit (SDK) sample.
It was built with Microsoft Visual C++(TM) version 2.1, the 32-bit
development system for Microsoft Windows(R), Windows 95, and Windows
NT(TM), and was tested under Windows NT version 3.51. Windows 95 was not
available for testing.
Since you have MSVC 4.1 look at TN057 also.
Richard A. Nichols
-----From: marty
Use VC++ to create a new DLL project (NOT using MFC)
Add one .cpp file which contains the following code:
----------------------------------------------
#include
BOOL WINAPI DLLEntryPoint (
HINSTANCE hInstance,
DWORD dwReason,
LPVOID pvReserved
)
{
return TRUE;
hInstance; dwReason; pvReserved; // only to avoid compiler warnings
}
-----------------------------------------------
Copy your .rc, resource.h, and any other resource files into the directory and include
the .rc file into the DLL project.
That's all there is to it.
(with thanks to Asmus Freytag's course at Windev East last week).
Marty Wagner
marty@concentra.com
Bruce R. Cochran -- brc@colossus.Storz.Com
Wednesday, July 03, 1996
Env: Environment: VC++ 4.1 / Win 95
This can be done in 4 steps easily:
1) Create Dll by selecting MFC Appwizard Dll from create project =
workspace menu
2) Go to files in the project and delete everything except the resource =
file (.RC file) and
can also delete from your disk too.
3) Go to resources and add the resources that you need
4) Go to Build settings and add the link option /noentry and then you =
are ready
to build your resource only dll.
| Вернуться в корень Архива
|