Click here to Skip to main content
15,897,704 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralExport Member function / class Pin
Steve Messer23-Mar-05 21:15
Steve Messer23-Mar-05 21:15 
GeneralRe: Export Member function / class Pin
David Crow24-Mar-05 5:43
David Crow24-Mar-05 5:43 
GeneralRe: Export Member function / class Pin
Steve Messer24-Mar-05 7:01
Steve Messer24-Mar-05 7:01 
GeneralRe: Export Member function / class Pin
cmk24-Mar-05 8:34
cmk24-Mar-05 8:34 
GeneralRe: Export Member function / class Pin
Steve Messer24-Mar-05 8:41
Steve Messer24-Mar-05 8:41 
GeneralRe: Export Member function / class Pin
cmk24-Mar-05 10:17
cmk24-Mar-05 10:17 
GeneralRe: Export Member function / class Pin
cmk24-Mar-05 10:24
cmk24-Mar-05 10:24 
GeneralRe: Export Member function / class Pin
Steve Messer24-Mar-05 13:21
Steve Messer24-Mar-05 13:21 
cmk wrote:
When the exe loads the dll have it call an Init() function that passes a pointer (or reference) for the App object to the dll, then the dll can just use that pointer (or reference) to call back to the exe. You don't need to use LoadLibrary() on the exe from the dll.

I tried something like that and I couldn't get it to compile. I tried the following:

// Set Pointer to CCOREDlg to g_System-----------------------------------------
HWND hCore;		
hCore = AfxGetApp()->m_pMainWnd->GetSafeHwnd();

CDialog* pDlg = DYNAMIC_DOWNCAST(CDialog, CWnd::FromHandlePermanent(hCore));
if (pDlg != NULL)
{
   CCOREDlg *pCore1;
   pCore1 = (CCOREDlg*)pDlg->GetRuntimeClass();

   CSystem * pSys = NULL;
   IMessage *pMsg = NULL;
   g_pSystem->pCore = pCore1;
   g_pSystem->pCore->OnMessage( pSys, pMsg );
}
//-------------------------------------------------------------------------


This code works fine from the exe but externally it complains that CCOREDlg is unknown.

Maybe I was doing something wrong??


cmk wrote:
I get the impression that you want this as generic as possible, but at some point you have to tell each side how to talk to the other.

Well, that is the crux of my dilemma. Communication to the dll is simple but the other direction is some what of a buggard.

Best case scenario for me would be to export the OnMessage function from the exe and then import it in the dll. But, I am a little fuzzy on the details for doing this.

Thanks for all the input.
GeneralRe: Export Member function / class Pin
cmk24-Mar-05 20:49
cmk24-Mar-05 20:49 
GeneralRe: Export Member function / class Pin
Steve Messer25-Mar-05 5:25
Steve Messer25-Mar-05 5:25 
GeneralRe: Export Member function / class Pin
Steve Messer25-Mar-05 9:51
Steve Messer25-Mar-05 9:51 
GeneralRe: Export Member function / class Pin
Steve Messer24-Mar-05 19:11
Steve Messer24-Mar-05 19:11 
GeneralRe: Export Member function / class Pin
David Crow24-Mar-05 8:38
David Crow24-Mar-05 8:38 
GeneralRe: Export Member function / class Pin
Steve Messer24-Mar-05 13:27
Steve Messer24-Mar-05 13:27 
GeneralDundas OXMultiComboBox crashes Pin
Bernhard23-Mar-05 20:01
Bernhard23-Mar-05 20:01 
Questionado can not run when WinXP update to sp2? Pin
Lido Paul23-Mar-05 19:54
Lido Paul23-Mar-05 19:54 
QuestionEnd of file? Pin
sacoskun23-Mar-05 19:49
sacoskun23-Mar-05 19:49 
AnswerRe: End of file? Pin
Steve Mayfield23-Mar-05 20:28
Steve Mayfield23-Mar-05 20:28 
GeneralRe: End of file? Pin
sacoskun23-Mar-05 20:38
sacoskun23-Mar-05 20:38 
GeneralRe: End of file? Pin
toxcct23-Mar-05 22:20
toxcct23-Mar-05 22:20 
AnswerRe: End of file? Pin
eli1502197923-Mar-05 22:33
eli1502197923-Mar-05 22:33 
GeneralIt complies and links but .... Pin
brilliant10123-Mar-05 18:11
brilliant10123-Mar-05 18:11 
GeneralMFC/GDI Chart Pin
Anonymous23-Mar-05 17:54
Anonymous23-Mar-05 17:54 
GeneralCustom DateTimePicker needed Pin
Mr. Malloc23-Mar-05 17:20
Mr. Malloc23-Mar-05 17:20 
GeneralReading and Loading files Pin
Notsosuperhero23-Mar-05 15:51
Notsosuperhero23-Mar-05 15:51 

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.