From: ThinkRS232 on
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