Re: DoModal() Dialog box fails in eVC4 to VS2005 Migration
- From: ThinkRS232 <ThinkRS232@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 21 Sep 2006 14:58:01 -0700
Hi Tom,
Egberto here:). Anyway when stepping through the MFC code it throws an
exception at the execution of
if (CreateDlgIndirect(lpDialogTemplate,CWnd::FromHandle(hWndParent), hInst))
found in the file dlgcore.cpp. The MFC code in dlgcore is listed below and
(e) = 0x2012ebf0 {m_bAutoDelete=1 m_bReadyForDelete=0} CException*
============================================
TRY
{
// create modeless dialog
AfxHookWindowCreate(this);
if (CreateDlgIndirect(lpDialogTemplate,CWnd::FromHandle(hWndParent), hInst))
{
if (m_nFlags & WF_CONTINUEMODAL)
{
// enter modal loop
DWORD dwFlags = MLF_SHOWONIDLE;
if (GetStyle() & DS_NOIDLEMSG) dwFlags |= MLF_NOIDLEMSG;
VERIFY(RunModalLoop(dwFlags) == m_nModalResult);
}
// hide the window before enabling the parent, etc.
if (m_hWnd != NULL)
SetWindowPos(NULL, 0, 0, 0, 0, SWP_HIDEWINDOW|
SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOZORDER);
}
}
CATCH_ALL(e)
{
DELETE_EXCEPTION(e);
m_nModalResult = -1;
}
END_CATCH_ALL
========================================
Any ideas?
--
WCSC (Willies Computer Software Co)
http://www.wcscnet.com
"Tom Serface" wrote:
Hi Think,.
Hey, I used to know a guy from your company a really long time ago when we
used your COM library back in the late 80's and early 90's (name Egberto if
I remember right).
Anyway, you can trace into DoModal() and see where it is failing in there
and that might help you get more information. it sounds like you are doing
all the right things, but perhaps it has something to do with a template
being changed or the resources not being set up right or something. Just a
thought.
Tom
"ThinkRS232" <ThinkRS232@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:0C3F88D6-6F29-4012-AB81-3E93CC36C326@xxxxxxxxxxxxxxxx
I have a Pocket PC 2003 MFC DLL that compiles and works perfectly under
eVC++
4.0. I imported the project into Visual Studio 2005. It compiles fine. The
problem is that the dialog box that it is supposed to display does not
display at all. After stepping through it I realize that the Dlg.DoModal()
is
returning -1.
I am following the rules which is calling
AFX_MANAGE_STATE(AfxGetStaticModuleState()); as the absolute first
statement
in the exported function. To be sure the exported function is as follows.
CDRVCEDLGS_API int WINAPI CdrvLInitDialog(
int &Subport,int &Baud,int &Parity,
int &Length,int &Stopbit,int &Protocol)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CCdrvLInitDlg Dlg;
int Status;
Dlg.m_Subport=Subport-1;
Dlg.m_Baud=Baud;
Dlg.m_Parity=Parity;
Dlg.m_Length=Length;
Dlg.m_Stopbit=Stopbit;
Dlg.m_Protocol=Protocol;
if ((Status=Dlg.DoModal()) == IDOK)
{
Subport=++Dlg.m_Subport;
Baud=Dlg.m_Baud;
Parity=Dlg.m_Parity;
Length=Dlg.m_Length;
Stopbit=Dlg.m_Stopbit;
Protocol=Dlg.m_Protocol;
}
return(Status);
}
Note that the OnInitDialog() is called successfully when Dlg is declared
above however Dlg.DoModal() returns -1. What could be causing this?
Regards
--
WCSC (Willies Computer Software Co)
http://www.wcscnet.com
- Follow-Ups:
- Re: DoModal() Dialog box fails in eVC4 to VS2005 Migration
- From: Tom Serface
- Re: DoModal() Dialog box fails in eVC4 to VS2005 Migration
- References:
- Re: DoModal() Dialog box fails in eVC4 to VS2005 Migration
- From: Tom Serface
- Re: DoModal() Dialog box fails in eVC4 to VS2005 Migration
- Prev by Date: Re: Accessing CView From CDocument
- Next by Date: Re: Global variable
- Previous by thread: Re: DoModal() Dialog box fails in eVC4 to VS2005 Migration
- Next by thread: Re: DoModal() Dialog box fails in eVC4 to VS2005 Migration
- Index(es):
Relevant Pages
|