Error accessing my Modeless Dialog from 3rd party application 
Author Message
 Error accessing my Modeless Dialog from 3rd party application

I have a DLL that contains a function which invokes a modeless dialog
box.  This function will be invoked from a 3rd party software tool
(Asymetrix ToolBook Instructor) to display the dialog box to the user.
When the DLL interface function (see below -- InvokeTestDiag) is called
it will properly invoke and display the dialog box correctly but any
time I move the mouse into the dialog box I get a fatal access violation
error.

Using the de{*filter*} I believe it is bombing in the AfxWndProc function on
the assert of the pWnd != NULL (permanent window not being equal to
null).  I believe I'm setting the window handle correctly (see below).

The 3rd party application works great with modal DLLs but I need this to
be modeless so that I can still access my windows in the 3rd party
application.

Also note that DLL works great (dialog box is displayed and accessible)
with a Visual C++ front end GUI.

Any suggestions, hints, or ideas?  Can this be done?

Code Snipet:

CTestDiag *test;

extern "C" void InvokeTestDiag(HWND m_hwnd)
{
 CWnd *m_parent;
 AFX_MANAGE_STATE(AfxGetStaticModuleState())

 m_parent = CWnd::FromHandle(m_hwnd);
 test = new CTestDiag;
 test->Create(IDD_TESTDIAG, m_parent);

Quote:
}

thanks,

Bob Connell

  rconnell.vcf
< 1K Download


Sun, 13 Jan 2002 03:00:00 GMT  
 Error accessing my Modeless Dialog from 3rd party application
CWnd::FromHandle returns a pointer to a temporary CWnd object.
As soon as there is some idle time, the temporary CWnd object gets
recycled. After that, your dialog points to some invalid parent window
and crashes as soon as it accesses that parent window. As a result
I think that your project gets a bit larger, because you have to find
all locations in MFC where CYourDialog (and all its base classes)
access the parent window and override those methods (which does
still not garantee, that you found all occurrences of that accesses).

Try CDialog::Create(IDD_TESTDIAG, NULL) not giving a parent window
(I don't know whether this works).

Regards, Roger

Quote:

>I have a DLL that contains a function which invokes a modeless dialog
>box.  This function will be invoked from a 3rd party software tool
>(Asymetrix ToolBook Instructor) to display the dialog box to the user.
>When the DLL interface function (see below -- InvokeTestDiag) is called
>it will properly invoke and display the dialog box correctly but any
>time I move the mouse into the dialog box I get a fatal access violation
>error.

>Using the de{*filter*} I believe it is bombing in the AfxWndProc function on
>the assert of the pWnd != NULL (permanent window not being equal to
>null).  I believe I'm setting the window handle correctly (see below).

>The 3rd party application works great with modal DLLs but I need this to
>be modeless so that I can still access my windows in the 3rd party
>application.

>Also note that DLL works great (dialog box is displayed and accessible)
>with a Visual C++ front end GUI.

>Any suggestions, hints, or ideas?  Can this be done?

>Code Snipet:

>CTestDiag *test;

>extern "C" void InvokeTestDiag(HWND m_hwnd)
>{
> CWnd *m_parent;
> AFX_MANAGE_STATE(AfxGetStaticModuleState())

> m_parent = CWnd::FromHandle(m_hwnd);
> test = new CTestDiag;
> test->Create(IDD_TESTDIAG, m_parent);
>}

>thanks,

>Bob Connell




Mon, 14 Jan 2002 03:00:00 GMT  
 Error accessing my Modeless Dialog from 3rd party application

Thanks Roger but that didn't work either. I beginning to wonder if it
can be done at all.

Bob

Quote:

> CWnd::FromHandle returns a pointer to a temporary CWnd object.
> As soon as there is some idle time, the temporary CWnd object gets
> recycled. After that, your dialog points to some invalid parent window
> and crashes as soon as it accesses that parent window. As a result
> I think that your project gets a bit larger, because you have to find
> all locations in MFC where CYourDialog (and all its base classes)
> access the parent window and override those methods (which does
> still not garantee, that you found all occurrences of that accesses).

> Try CDialog::Create(IDD_TESTDIAG, NULL) not giving a parent window
> (I don't know whether this works).

> Regards, Roger


> >I have a DLL that contains a function which invokes a modeless dialog
> >box.  This function will be invoked from a 3rd party software tool
> >(Asymetrix ToolBook Instructor) to display the dialog box to the user.
> >When the DLL interface function (see below -- InvokeTestDiag) is called
> >it will properly invoke and display the dialog box correctly but any
> >time I move the mouse into the dialog box I get a fatal access violation
> >error.

> >Using the de{*filter*} I believe it is bombing in the AfxWndProc function on
> >the assert of the pWnd != NULL (permanent window not being equal to
> >null).  I believe I'm setting the window handle correctly (see below).

> >The 3rd party application works great with modal DLLs but I need this to
> >be modeless so that I can still access my windows in the 3rd party
> >application.

> >Also note that DLL works great (dialog box is displayed and accessible)
> >with a Visual C++ front end GUI.

> >Any suggestions, hints, or ideas?  Can this be done?

> >Code Snipet:

> >CTestDiag *test;

> >extern "C" void InvokeTestDiag(HWND m_hwnd)
> >{
> > CWnd *m_parent;
> > AFX_MANAGE_STATE(AfxGetStaticModuleState())

> > m_parent = CWnd::FromHandle(m_hwnd);
> > test = new CTestDiag;
> > test->Create(IDD_TESTDIAG, m_parent);
> >}

> >thanks,

> >Bob Connell


  rconnell.vcf
< 1K Download


Mon, 14 Jan 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Error accessing my Modeless Dialog from 3rd party application

2. Subclassing a 3rd party application?!?

3. LNK2001 error with 3rd party lib

4. Accessing a parent dialog's controls from a child modeless dialog

5. Modeless Dialog box in a Modal Dialog Application...

6. Using 3rd party C library in Managed C++

7. Best 3rd party components

8. 3rd party frameworks and libraries?

9. 3rd party components

10. Recommendations for a good 3rd party DataGrid windows control

11. Scounting for 3rd party control packages

12. How to link a 3rd party .LIB to turboC v3.0

 

 
Powered by phpBB® Forum Software