From: ScottMcP [MVP] on 25 Oct 2009 11:58 On Oct 24, 11:23 pm, Bidski <bids...(a)gmail.com> wrote: > That still doesnt appear to be working as expected. The form is still > displaying to the screen fully loaded and if I display a message box > in the event handler it appears before the form does. Is there some > sort of definitive way that I can test to see exactly when the event > is being triggered?- Hide quoted text - MessageBox is not a good test since it pumps messages when it is displayed, possibly changing the flow. The definitive way to trace the sequence of operations is to add OutputDebugString calls here and there. The output appears in the Visual Studio output window.
From: Bidski on 26 Oct 2009 03:51 On Oct 26, 2:58 am, "ScottMcP [MVP]" <scott...(a)mvps.org> wrote: > On Oct 24, 11:23 pm, Bidski <bids...(a)gmail.com> wrote: > > > That still doesnt appear to be working as expected. The form is still > > displaying to the screen fully loaded and if I display a message box > > in the event handler it appears before the form does. Is there some > > sort of definitive way that I can test to see exactly when the event > > is being triggered?- Hide quoted text - > > MessageBox is not a good test since it pumps messages when it is > displayed, possibly changing the flow. The definitive way to trace > the sequence of operations is to add OutputDebugString calls here and > there. The output appears in the Visual Studio output window. This is definitely still happening before the dialog is shown to the screen. My code is as follows: BOOL CInventory::OnInitDialog() { CDialog::OnInitDialog(); // Some loading happens here OutputDebugString("Calling OnDialogLoaded\n"); ::PostMessage(this->m_hWnd, WM_DIALOG_LOADED, (WPARAM)0, (LPARAM)0); OutputDebugString("After PostMessage\n"); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } LRESULT CInventory::OnDialogLoaded(UINT wParam, LONG lParam) { OutputDebugString("OnDialogLoaded\n"); // I do my loading here. OutputDebugString("OnDialogLoaded completed\n"); return 0; // I handled this message } And here is a small transcript of the debug window Calling OnDialogLoaded After PostMessage OnDialogLoaded OnDialogLoaded completed // The form displays to the screen here. WM_DIALOG_LOADED = WM_APP + 1 Does that look like it should? Can you give any further pointers? Thanks Bidski
From: ScottMcP [MVP] on 26 Oct 2009 13:39 On Oct 26, 3:51 am, Bidski <bids...(a)gmail.com> wrote: > Calling OnDialogLoaded > After PostMessage > OnDialogLoaded > OnDialogLoaded completed > // The form displays to the screen here. > > WM_DIALOG_LOADED = WM_APP + 1 > > Does that look like it should? Can you give any further pointers? > > Thanks > Bidski Yes, that looks right. A couple of things you can try to see what is happening: - Add an OutputDebugString to OnPaint - Add a Sleep(2000) in the message handler. When I do this I see OnPaint execute before the message handler executes.
From: Bidski on 26 Oct 2009 15:49 On Oct 27, 4:39 am, "ScottMcP [MVP]" <scott...(a)mvps.org> wrote: > On Oct 26, 3:51 am, Bidski <bids...(a)gmail.com> wrote: > > > Calling OnDialogLoaded > > After PostMessage > > OnDialogLoaded > > OnDialogLoaded completed > > // The form displays to the screen here. > > > WM_DIALOG_LOADED = WM_APP + 1 > > > Does that look like it should? Can you give any further pointers? > > > Thanks > > Bidski > > Yes, that looks right. A couple of things you can try to see what is > happening: > - Add an OutputDebugString to OnPaint > - Add a Sleep(2000) in the message handler. > > When I do this I see OnPaint execute before the message handler > executes. OnPaint is executing after the message handler for me
From: ScottMcP [MVP] on 26 Oct 2009 17:59 On Oct 26, 3:49 pm, Bidski <bids...(a)gmail.com> wrote: > > OnPaint is executing after the message handler for me > That's really surprising. It works for me, and has always worked for me. Did you try it in a little new project? Which OS version are you using?
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: Question about win32 C++ roles Next: add text in existing file problam |