Click here to Skip to main content
15,908,674 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionLinking to MFC in a non-MFC dll [modified] Pin
Leslie Sanford3-Oct-07 9:45
Leslie Sanford3-Oct-07 9:45 
AnswerRe: Linking to MFC in a non-MFC dll Pin
Nathan Holt at EMOM3-Oct-07 10:49
Nathan Holt at EMOM3-Oct-07 10:49 
AnswerRe: Linking to MFC in a non-MFC dll Pin
Mark Salsbery3-Oct-07 11:31
Mark Salsbery3-Oct-07 11:31 
GeneralRe: Linking to MFC in a non-MFC dll Pin
Leslie Sanford3-Oct-07 13:59
Leslie Sanford3-Oct-07 13:59 
GeneralRe: Linking to MFC in a non-MFC dll Pin
Mark Salsbery4-Oct-07 5:40
Mark Salsbery4-Oct-07 5:40 
GeneralRe: Linking to MFC in a non-MFC dll Pin
Leslie Sanford4-Oct-07 6:25
Leslie Sanford4-Oct-07 6:25 
GeneralRe: Linking to MFC in a non-MFC dll Pin
Mark Salsbery4-Oct-07 6:43
Mark Salsbery4-Oct-07 6:43 
GeneralRe: Linking to MFC in a non-MFC dll Pin
Leslie Sanford4-Oct-07 6:56
Leslie Sanford4-Oct-07 6:56 
Mark Salsbery wrote:
What HWND are you obtaining a CWnd for? Are you doing this in your DLL?


The HWND handle is given to me by the host. In response, I'm suppose to create a child window using the specified handle as the parent and display it. The user interacts with the child window making edits to the data in the dll. Something like:

void Editor::open(void *ptr)
{
    HWND parent = (HWND)ptr;
 
    myEditorDlg = new CMyEditorDlg(CMyEditorDlg::IDD, CWnd::FromHandle(parent));
    myEditorDlg->ShowWindow(SW_SHOWNORMAL);
    myEditorDlg->UpdateWindow();   
}


open is called by the host. On windows ptr is a HWND handle.

Mark Salsbery wrote:
There's a couple important issues with this:

1) Windows messages need to get routed to the MFC message system
2) Except with an MFC extension DLL, you can't pass any MFC objects
directly or indirectly across the exe/dll boundary.


This is what I gathered from the link to the webpage you posted. But someone on another group posted code supposedly doing just that (it looks close to what I posted above). When I tried it, I thought it worked at first, but a closer look and I realized I was getting all kinds of memory errors/exceptions.
GeneralRe: Linking to MFC in a non-MFC dll Pin
Mark Salsbery4-Oct-07 7:11
Mark Salsbery4-Oct-07 7:11 
GeneralRe: Linking to MFC in a non-MFC dll Pin
Leslie Sanford4-Oct-07 7:48
Leslie Sanford4-Oct-07 7:48 
GeneralRe: Linking to MFC in a non-MFC dll Pin
Mark Salsbery4-Oct-07 7:54
Mark Salsbery4-Oct-07 7:54 
GeneralRe: Linking to MFC in a non-MFC dll Pin
Mark Salsbery4-Oct-07 6:48
Mark Salsbery4-Oct-07 6:48 
QuestionJump from one Dialog to other in a Dialog MFC application Pin
TomWizard3-Oct-07 7:59
TomWizard3-Oct-07 7:59 
AnswerRe: Jump from one Dialog to other in a Dialog MFC application Pin
Maximilien3-Oct-07 9:13
Maximilien3-Oct-07 9:13 
Questiontokenizer help Pin
dellthinker3-Oct-07 7:14
dellthinker3-Oct-07 7:14 
AnswerRe: tokenizer help Pin
Nemanja Trifunovic3-Oct-07 7:44
Nemanja Trifunovic3-Oct-07 7:44 
GeneralRe: tokenizer help Pin
dellthinker3-Oct-07 9:37
dellthinker3-Oct-07 9:37 
AnswerRe: tokenizer help Pin
Stephen Hewitt3-Oct-07 14:23
Stephen Hewitt3-Oct-07 14:23 
AnswerRe: tokenizer help Pin
DQNOK4-Oct-07 4:30
professionalDQNOK4-Oct-07 4:30 
GeneralRe: tokenizer help Pin
dellthinker4-Oct-07 8:27
dellthinker4-Oct-07 8:27 
QuestionSidebar like Vista sidebar for all os Windows 2000, XP , 2003 Pin
Sudhir Mangla3-Oct-07 5:18
professionalSudhir Mangla3-Oct-07 5:18 
QuestionCorba - Trail Version/Freeware for VS 2005 C++ Pin
Andy2023-Oct-07 3:23
Andy2023-Oct-07 3:23 
QuestionWhere my object are stored Pin
manustone3-Oct-07 3:10
manustone3-Oct-07 3:10 
AnswerRe: Where my object are stored Pin
Iain Clarke, Warrior Programmer3-Oct-07 4:37
Iain Clarke, Warrior Programmer3-Oct-07 4:37 
GeneralRe: Where my object are stored Pin
manustone3-Oct-07 6:43
manustone3-Oct-07 6:43 

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.