[MFC] - Chargement d'une dll de ressource et d'une MDI
Re hello,
je suis toujours entrain de me battre avec ma dll de ressource.
J'ai suivi pas à pas l'article de Farscape dans la FAQ.
Voici ce que donne ma fonction InitInstance :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
//--------------------------------------------------------------
// Chargement de la librairie adéquate
// pour l'instant je ne laisse pas le choix de la langue pour mes tests
WriteProfileInt("Language","SetInFr",true);
m_bFrenchRes=(GetProfileInt("Language","SetInFr",0)==1);
if(m_bFrenchRes)
{
HINSTANCE dll=LoadLibrary("Pilot3D_Fr.dll");
if(dll)
{
AfxSetResourceHandle(dll);
}
}
//--------------------------------------------------------------
// Change the registry key under which our settings are stored.
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization.
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
LoadStdProfileSettings(); // Load standard INI file options (including MRU)
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.
CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(
IDR_PILOT3TYPE,
RUNTIME_CLASS(CPilot3DDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CPilot3DView));
AddDocTemplate(pDocTemplate);
// create main MDI Frame window
CMainFrame* pMainFrame = new CMainFrame;
if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
{
return FALSE;
}
m_pMainWnd = pMainFrame ;
// je n'ai pas de view ni de doc dans cette application
// je n'ai que des DialogBar ou des boîtes de dialogues classiques
/*
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
*/
// The main window has been initialized, so show and update it.
pMainFrame->ShowWindow(m_nCmdShow);
pMainFrame->UpdateWindow(); |
Mon problème est que tout se passe bien jusqu'au chargement de la ressource IDR_MAINFRAME avec LoadFrame :
le chargement ne se fait pas et la fonction sort avec un return FALSE.
(bien entendu ça compile et ça link sans aucun problème).
Est ce que quelqu'un a déjà rencontré ce problème ?
Merci
Alice