Re: DoModal() Dialog box fails in eVC4 to VS2005 Migration

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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



.



Relevant Pages

  • Re: DoModal() Dialog box fails in eVC4 to VS2005 Migration
    ... The dialog template is read based on an index ... Anyway when stepping through the MFC code it throws an ... being changed or the resources not being set up right or something. ... CDRVCEDLGS_API int WINAPI CdrvLInitDialog( ...
    (microsoft.public.vc.mfc)
  • Strange Operator
    ... I have been stepping though some code, ... (value is an int) ... It seems to be assigning 1 to value, could anyone shed some light on its ... Simon Lewis ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Strange Operator
    ... | I have been stepping though some code, ... | (value is an int) ... It's affect is to shift all bit's to the right, ... and assignment within the same expression. ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Strange Operator
    ... > I have been stepping though some code, ... > (value is an int) ... where>> is the right shift operator ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Question: How to kill the console window?
    ... int main(int argc, char *argv) ... int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPTSTR lpCmdLine, int nCmdShow) ...
    (microsoft.public.vstudio.development)