Re: SetWindowPos unhandled exception only in release system
- From: "AliR" <AliR@xxxxxxxxxxxxx>
- Date: Wed, 8 Mar 2006 10:38:11 -0600
put a try catch block around the code and see what the exception is
try
{
CRect ParentRect;
GetParent()->GetClientRect (&ParentRect);
CRect OurRect;
GetClientRect (&OurRect);
// compute position for this window
int Column = (m_Number - 1) % MAX_COLUMNS;
int Row = (m_Number - 1) / MAX_COLUMNS;
int xOffset = X_OFFSET_START + (Column * (OurRect.Width() +
COLUMN_SPACE));
int yOffset = Y_OFFSET_START + (Row * (OurRect.Height() +
ROW_SPACE));
SetWindowPos(GetParent(),
ParentRect.left + xOffset,
ParentRect.top + yOffset,
0, 0, // ignores size arguments
SWP_NOSIZE | SWP_NOZORDER);
}
catch (CException *E)
{
E->ReportError();
}
AliR.
"NYC Lou" <louseitchikorders@xxxxxxxxxxxxx> wrote in message
news:1141785531.891768.148170@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I have a class derived from CDialog. In its OnInitDialog(), I call
SetWindowPos() as shown below. Under debug, it works fine. In the
release version, I get an unhandled exception access violation in
MFC42.DLL.
Any ideas?
Thanks so much.
BOOL CDlgPortStatus::OnInitDialog()
{
CDialog::OnInitDialog();
// place the window based on its number
CRect ParentRect;
GetParent()->GetClientRect (&ParentRect);
CRect OurRect;
GetClientRect (&OurRect);
// compute position for this window
int Column = (m_Number - 1) % MAX_COLUMNS;
int Row = (m_Number - 1) / MAX_COLUMNS;
int xOffset = X_OFFSET_START + (Column * (OurRect.Width() +
COLUMN_SPACE));
int yOffset = Y_OFFSET_START + (Row * (OurRect.Height() +
ROW_SPACE));
SetWindowPos(GetParent(),
ParentRect.left + xOffset,
ParentRect.top + yOffset,
0, 0, // ignores size arguments
SWP_NOSIZE | SWP_NOZORDER);
.
- References:
- SetWindowPos unhandled exception only in release system
- From: NYC Lou
- SetWindowPos unhandled exception only in release system
- Prev by Date: Re: SetWindowPos unhandled exception only in release system
- Next by Date: Re: Simple Input In a MFC application
- Previous by thread: Re: SetWindowPos unhandled exception only in release system
- Next by thread: New essay: whereis utility
- Index(es):
Relevant Pages
|