Click here to Skip to main content
15,901,927 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Can't remember... Pin
WebmastaX28-Sep-03 7:35
WebmastaX28-Sep-03 7:35 
GeneralAcceptEx with WSASend and WSARecv :: Winsock Pin
valikac25-Sep-03 19:16
valikac25-Sep-03 19:16 
Generaldialogbased App+ iostream Pin
KKR25-Sep-03 18:27
KKR25-Sep-03 18:27 
QuestionDo you know the definition of "overloading"? Pin
Link260025-Sep-03 16:50
Link260025-Sep-03 16:50 
AnswerRe: Do you know the definition of "overloading"? Pin
spiritualfields25-Sep-03 17:47
spiritualfields25-Sep-03 17:47 
GeneralVC6 vs VC7 Pin
spiritualfields25-Sep-03 16:14
spiritualfields25-Sep-03 16:14 
GeneralRe: VC6 vs VC7 Pin
Joe Woodbury25-Sep-03 18:09
professionalJoe Woodbury25-Sep-03 18:09 
GeneralCalling CWnd::MoveWindow from within OnSize handler - CRASH Pin
Terry O'Nolley25-Sep-03 16:02
Terry O'Nolley25-Sep-03 16:02 
In the OnSize handler of my main window (CDialog) I am trying to reposition a listbox in my OnSize handler. I have the following code (I have stripped it down to what is still causing the crash. The assertion error only occurs when the window is first displayed.

void CDlg::OnSize(UINT nType, int cx, int cy) <br />
{<br />
   m_ListBox.MoveWindow(10, 10, 50, 50, TRUE);<br />
   CDialog::OnSize(nType, cx, cy);<br />
}

The error is an assertion failing in winocc.cpp:

void CWnd::MoveWindow(int x, int y, int nWidth, int nHeight, BOOL bRepaint)<br />
{<br />
   ASSERT(::IsWindow(m_hWnd));<br />
<br />
   if (m_pCtrlSite == NULL)<br />
      ::MoveWindow(m_hWnd, x, y, nWidth, nHeight, bRepaint);<br />
   else<br />
      m_pCtrlSite->MoveWindow(x, y, nWidth, nHeight, bRepaint);<br />
}

If I click "Ignore" when presented with the assertion error, execution continues just fine except that the listbox didn't get repositioned. On all subsequent OnSize calls, the listbox gets repositioned correctly.

Since I know the starting size of my dialog box, I can work around this by setting a flag so that during the initial OnSize call it won't reposition the listbox and I can just futz around in the resource editor trying to position it but it seems this isn't the right way to do this.

Can anyone help here?










GeneralRe: Calling CWnd::MoveWindow from within OnSize handler - CRASH Pin
Larry J. Siddens25-Sep-03 16:07
Larry J. Siddens25-Sep-03 16:07 
GeneralRe: Calling CWnd::MoveWindow from within OnSize handler - CRASH Pin
Terry O'Nolley25-Sep-03 16:35
Terry O'Nolley25-Sep-03 16:35 
GeneralRe: Calling CWnd::MoveWindow from within OnSize handler - CRASH Pin
Shog925-Sep-03 18:57
sitebuilderShog925-Sep-03 18:57 
GeneralRe: Calling CWnd::MoveWindow from within OnSize handler - CRASH Pin
Terry O'Nolley26-Sep-03 4:11
Terry O'Nolley26-Sep-03 4:11 
GeneralRe: Calling CWnd::MoveWindow from within OnSize handler - CRASH Pin
Shog926-Sep-03 4:46
sitebuilderShog926-Sep-03 4:46 
GeneralRe: Calling CWnd::MoveWindow from within OnSize handler - CRASH Pin
Abin25-Sep-03 21:32
Abin25-Sep-03 21:32 
GeneralRe: Calling CWnd::MoveWindow from within OnSize handler - CRASH Pin
FearlessBurner26-Sep-03 0:15
FearlessBurner26-Sep-03 0:15 
Generalfree memory Pin
Sirrius25-Sep-03 15:01
Sirrius25-Sep-03 15:01 
GeneralRe: free memory Pin
Larry J. Siddens25-Sep-03 16:12
Larry J. Siddens25-Sep-03 16:12 
GeneralVisual C++ and Standard C++ Pin
RanBlade25-Sep-03 13:53
RanBlade25-Sep-03 13:53 
GeneralRe: Visual C++ and Standard C++ Pin
Taka Muraoka25-Sep-03 14:09
Taka Muraoka25-Sep-03 14:09 
GeneralRe: Visual C++ and Standard C++ Pin
RanBlade25-Sep-03 14:15
RanBlade25-Sep-03 14:15 
GeneralRe: Visual C++ and Standard C++ Pin
RanBlade25-Sep-03 14:17
RanBlade25-Sep-03 14:17 
GeneralRe: Visual C++ and Standard C++ Pin
Taka Muraoka25-Sep-03 14:31
Taka Muraoka25-Sep-03 14:31 
GeneralRe: Visual C++ and Standard C++ Pin
Joe Woodbury25-Sep-03 18:16
professionalJoe Woodbury25-Sep-03 18:16 
GeneralSimple operation with window minimized... Pin
Anonymous25-Sep-03 13:30
Anonymous25-Sep-03 13:30 
GeneralC and memory help Pin
Sirrius25-Sep-03 12:39
Sirrius25-Sep-03 12:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.