From: Andrew Mann on
I am trying to create a dialog bar inside a regular mfc dll with a frame
window as its parent. The code for the export function that is supposed to
create the dialog bar and attach it to the main window is below:

extern "C" LINK_DLL CDialogBar* APIENTRY CreateDlgBar(HWND hWnd)

{

AFX_MANAGE_STATE(AfxGetStaticModuleState());

if( !theApp.m_wndTestDlgBar.Create( CWnd::FromHandle(hWnd),
IDD_DIALOG_TESTBAR,

CBRS_TOP, IDD_DIALOG_TESTBAR ) )

{

TRACE0("Cannot create the Dialog bar");

}

return &theApp.m_wndTestDlgBar;

}


I have also created another export function which is called from
PreTranslateMessage of the main windows app which is supposed to route
message to the dialog bar. Code below

extern "C" LINK_DLL BOOL WINAPI FilterDllMsg( LPMSG lpMsg )

{

AFX_MANAGE_STATE(AfxGetStaticModuleState());

TRY

{

return AfxGetThread()->PreTranslateMessage(lpMsg);

}

END_TRY

return TRUE;

}


The CDialogBar Create() function appears to work but the dialog bar does not
appear at all on the main window. Does anyone have any suggestion on how I
can make my dialog bar work from within a DLL?

Thanks in advance.




From: KMA on
Where is the dialog resource IDD_DIALOG_TESTBAR ?

Is it available to the calling exe?


"Andrew Mann" <amann17(a)bigpond.net.au> wrote in message
news:lPfjf.7552$ea6.5561(a)news-server.bigpond.net.au...
> I am trying to create a dialog bar inside a regular mfc dll with a frame
> window as its parent. The code for the export function that is supposed
to
> create the dialog bar and attach it to the main window is below:
>
> extern "C" LINK_DLL CDialogBar* APIENTRY CreateDlgBar(HWND hWnd)
>
> {
>
> AFX_MANAGE_STATE(AfxGetStaticModuleState());
>
> if( !theApp.m_wndTestDlgBar.Create( CWnd::FromHandle(hWnd),
> IDD_DIALOG_TESTBAR,
>
> CBRS_TOP, IDD_DIALOG_TESTBAR ) )
>
> {
>
> TRACE0("Cannot create the Dialog bar");
>
> }
>
> return &theApp.m_wndTestDlgBar;
>
> }
>
>
> I have also created another export function which is called from
> PreTranslateMessage of the main windows app which is supposed to route
> message to the dialog bar. Code below
>
> extern "C" LINK_DLL BOOL WINAPI FilterDllMsg( LPMSG lpMsg )
>
> {
>
> AFX_MANAGE_STATE(AfxGetStaticModuleState());
>
> TRY
>
> {
>
> return AfxGetThread()->PreTranslateMessage(lpMsg);
>
> }
>
> END_TRY
>
> return TRUE;
>
> }
>
>
> The CDialogBar Create() function appears to work but the dialog bar does
not
> appear at all on the main window. Does anyone have any suggestion on how
I
> can make my dialog bar work from within a DLL?
>
> Thanks in advance.
>
>
>
>


From: Ajay Kalra on
Couple of things:

- Why are you using a regular DLL for this?
- Which module has the resource that you are trying to access?

Typically you should use a MFC Extension DLL instead.

----------
Ajay Kalra
ajaykalra(a)yahoo.com