Re: DoModal() Dialog box fails in eVC4 to VS2005 Migration
- From: "Tom Serface" <tserface@xxxxxxx>
- Date: Thu, 21 Sep 2006 15:31:32 -0700
The first thing I'd look at is the lpDialogTemplate. It could be that
someone has called AfxSetResourceHandle() somewhere and set the resources to
another handle where the dialog doesn't exist. Although, if you are just
compiling from something that worked previously without modification I can't
figure why it would happen. I've just seen that happen before...
1. The dialog template is read based on an index (ID)
2. The template is invalid
3. It blows because it should have found the dialog, but it did not.
Tom
P.S., My buddy Martin Nohr and I (Tom Serface) used to have a company called
PereLine Data Systems (product PereLine) back in the day. We sold the
company in 1994 so it's been a while, but I remember Martin doing a lot of
stuff with your code when we switched to using your lib instead of trying to
do it all ourselves. Ah the memories.
"ThinkRS232" <ThinkRS232@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:4F65C522-AAF5-4AD5-900D-9A245C82729D@xxxxxxxxxxxxxxxx
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
.
- References:
- Re: DoModal() Dialog box fails in eVC4 to VS2005 Migration
- From: Tom Serface
- Re: DoModal() Dialog box fails in eVC4 to VS2005 Migration
- From: ThinkRS232
- Re: DoModal() Dialog box fails in eVC4 to VS2005 Migration
- Prev by Date: Re: problem with PostMessage
- Next by Date: Regular MFC dll linking to Extension MFC dll (Class Size Limit?)
- Previous by thread: Re: DoModal() Dialog box fails in eVC4 to VS2005 Migration
- Next by thread: Regular MFC dll linking to Extension MFC dll (Class Size Limit?)
- Index(es):
Relevant Pages
|
Loading