Re: Getting error code 6 when creating a dialog
- From: r_z_aret@xxxxxxxxxxxx
- Date: Wed, 21 Mar 2007 17:10:08 -0500
On Wed, 21 Mar 2007 08:15:58 -0700, mpr138
<mpr138@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
I am running the following code in CE5.0
CDialog* tempDlg = new CDialogTestDlg();
tempDlg->Create(IDD_DIALOGTEST_DIALOG);
m_pMainWnd = tempDlg;
tempDlg->ShowWindow(SW_SHOW);
DWORD dword = GetLastError();
dword always comes back with an error code of 6 which is invalid handle. The
Call GetLastError only immediately after you call the function you are
trying to check, and only if that function fails. I don't think
ShowWindow ever fails, so calling GetLastError after calling
ShowWindow will be misleading. I suggest the following modification:
CDialog* tempDlg = new CDialogTestDlg();
if (!tempDlg->Create(IDD_DIALOGTEST_DIALOG))
{
DWORD dword = GetLastError();
return;
}
m_pMainWnd = tempDlg;
tempDlg->ShowWindow(SW_SHOW);
window visually appears to be created successfully 80% of the time. The other
20% of the time we are missing fields on the dialog and the application
crashes. Some of the times we notice the dialog is missing fields, we get an
assert on the windows handle, but most of the time we don't. This code is the
same on pocket pc 2003 and windows moblie 5.0 and we do not get the error
I don't have any explanation for the intermittent part. I also don't
see anything in your code snippet that should behave differently on
Pocket PC 2003 and Windows Mobile 5. However, the code in you snippet
might have problems if your menus are set up correctly. Are you using
proper Pocket PC menus?
code 6 from GetLastError. We have also noticed this happen on the Create call
everywhere else in the application. Any help that can be provided would be
greatly appreciated.
-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).
Robert E. Zaret, eMVP
PenFact, Inc.
20 Park Plaza, Suite 478
Boston, MA 02116
www.penfact.com
.
- Prev by Date: Re: Booting on a WinCE 6.0 on an ARM9 SOC based device
- Next by Date: Re: interrupt- stream driver- wince 6
- Previous by thread: PKCS_7_ASN_ENCODING on Windows CE 5.0
- Next by thread: why CE 6.0 command bar of my MFC application cannot show normally
- Index(es):
Relevant Pages
|