Click here to Skip to main content
15,922,512 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Displaying Symbol issue......... Pin
toxcct26-Jan-09 3:08
toxcct26-Jan-09 3:08 
GeneralRe: Displaying Symbol issue......... Pin
CPallini26-Jan-09 3:16
mveCPallini26-Jan-09 3:16 
GeneralRe: Displaying Symbol issue......... Pin
El Corazon26-Jan-09 3:19
El Corazon26-Jan-09 3:19 
GeneralRe: Displaying Symbol issue......... Pin
CPallini26-Jan-09 3:29
mveCPallini26-Jan-09 3:29 
GeneralRe: Displaying Symbol issue......... Pin
toxcct26-Jan-09 4:09
toxcct26-Jan-09 4:09 
GeneralRe: Displaying Symbol issue......... Pin
CPallini26-Jan-09 6:43
mveCPallini26-Jan-09 6:43 
GeneralRe: Displaying Symbol issue......... Pin
Eytukan26-Jan-09 18:52
Eytukan26-Jan-09 18:52 
GeneralRe: Displaying Symbol issue......... Pin
CPallini27-Jan-09 0:47
mveCPallini27-Jan-09 0:47 
JokeRe: Displaying Symbol issue......... Pin
toxcct30-Jan-09 1:54
toxcct30-Jan-09 1:54 
GeneralRe: Displaying Symbol issue......... Pin
Eytukan30-Jan-09 6:55
Eytukan30-Jan-09 6:55 
GeneralRe: Displaying Symbol issue......... Pin
Cedric Moonen26-Jan-09 3:37
Cedric Moonen26-Jan-09 3:37 
GeneralRe: Displaying Symbol issue......... Pin
CPallini26-Jan-09 3:51
mveCPallini26-Jan-09 3:51 
GeneralRe: Displaying Symbol issue......... Pin
Rajesh R Subramanian26-Jan-09 4:08
professionalRajesh R Subramanian26-Jan-09 4:08 
GeneralRe: Displaying Symbol issue......... Pin
toxcct26-Jan-09 4:16
toxcct26-Jan-09 4:16 
GeneralRe: Displaying Symbol issue......... Pin
Rajesh R Subramanian26-Jan-09 4:03
professionalRajesh R Subramanian26-Jan-09 4:03 
GeneralRe: Displaying Symbol issue......... Pin
toxcct26-Jan-09 4:08
toxcct26-Jan-09 4:08 
GeneralRe: Displaying Symbol issue......... Pin
Rajesh R Subramanian26-Jan-09 4:15
professionalRajesh R Subramanian26-Jan-09 4:15 
GeneralRe: Displaying Symbol issue......... Pin
toxcct26-Jan-09 4:20
toxcct26-Jan-09 4:20 
JokeRe: Displaying Symbol issue......... Pin
CPallini26-Jan-09 6:48
mveCPallini26-Jan-09 6:48 
QuestionWorking with DB Pin
CodingLover25-Jan-09 18:33
CodingLover25-Jan-09 18:33 
QuestionRe: Working with DB Pin
David Crow26-Jan-09 2:56
David Crow26-Jan-09 2:56 
AnswerRe: Working with DB Pin
Jose David Pujo26-Jan-09 4:38
Jose David Pujo26-Jan-09 4:38 
QuestionAfxGetInstanceHandle Crash in MFC Extension dlls Pin
Neptunex25-Jan-09 17:55
Neptunex25-Jan-09 17:55 
AnswerRe: AfxGetInstanceHandle Crash in MFC Extension dlls Pin
Randor 25-Jan-09 18:23
professional Randor 25-Jan-09 18:23 
AnswerRe: AfxGetInstanceHandle Crash in MFC Extension dlls Pin
Neptunex26-Jan-09 0:53
Neptunex26-Jan-09 0:53 
First of all answers to above questions:

1) Refering to Memory Management section of Extension DLLs in MSDN:

MFCx0.dll and all extension DLLs loaded into a client application's address space use the same memory allocator, resource loading, and other MFC global states as if they were in the same application. This is significant because the non-MFC DLL libraries and the regular DLLs do the exact opposite and have each DLL allocating out of its own memory pool.

If an extension DLL allocates memory, that memory can freely intermix with any other application-allocated object. Also, if an application that dynamically links to MFC fails, the protection of the operating system maintains the integrity of any other MFC application sharing the DLL.

Similarly other global MFC states, like the current executable file to load resources from, are also shared between the client application and all MFC extension DLLs as well as MFCx0.dll itself.


So I expect to receive the address space of process executable.

I checked hInstance value in DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved), it was 0x10000000 but it was not equal to the value returned by AfxGetInstanceHandle in process executable which was 0x00400000, despite the fact that they should have been the same!

2) Yes it's been properly initialized using AfxInitExtensionModule in its DllMain

3) AfxGetInstanceHandle asserts in its ASSERT(afxCurrentInstanceHandle != NULL); line

And I cannot use the code that you've mentioned because AfxGetInstanceHandle is also called from functions within MFC that I have no control on such as CWnd::CreateEx that cause the assertion again.

I really have no idea why MFC might have not been properly initialized! Frown | :(

Thank you for your feedback Smile | :)

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.