Similar Threads
1. Calling SetWindowTitle Just After Dialog Creation Causes
2. ? Post Window (Dialog) Creation Flag
Hi,
I've searched high and low (mostly low) but can't find anything about how to determine if a window (specifically a dialog and it's
controls) is completely created.
As you know, a window may/will receive all kinds of messages while it's being created. Unfortunately, sometimes we write message
handlers that are to be executed AFTER the dialog and all of it's controls are created.
For example, moving/sizing controls in a dialog box is done in OnSize as expected. However, WM_SIZE is sent to the window before
the controls even exist. To avoid an exception, you have to check that the controls are there before performing the actions on
them.
Instead of using the common method for testing the control's existence:
OnSize {
if (GetDlgItem(IDC_SOME_CONTROL)!=NULL) {
//or
//if (SomeControl.GetSafeHwnd() !=NULL) {
// perform actions on controls
}
}
I would like to use a simple one-shot flag. That is, I am trying to make a simple member boolean that is set to false in the
constructor, then set to true when the window is finished being created. From then on, any tests for control existence would just
check that instead of calling a function. While it doesn't seem like a big deal, it could be. For example, if you are resizing a
window, it will receive a lot of WM_SIZE messages, and having it do the extra overhead could possibly have a noticeable impact.
Even if it doesn't, using a flag is just more elegant, that's what _flags_ are for.
However, I cannot find a way to determine when the window is finished being created. I vaguely remember there being some kind of
message that is sent when it's done but I can't find it, so I'm not so sure anymore.
I tried setting the flag in OnSize but it didn't work because it was only called once on dialog creation, at which point the
controls didn't yet exist; it was not called again after the controls were there.
Does anyone know of a way to determine if the window is completed?
Thanks a lot.
--
Alec S.
news/alec->synetech/cjb/net
3. getting default printer name at time of dialog creation.
4. dynamic creation of dialog elements
5. Dynamic creation of owner-drawn button inside a dialog
6. Displaying progress bar status in a dialog of another dialog w
I haven't done multi threading before. I'll have to read up on it tonight.
Thank you Daniel.
--
Thanks.
"Daniel" wrote:
> Multi threading.
>
> You run the progress bar dialog on a second thread and update it via thread
> safe calls using invoke to fire a method saftely on the second thread when
> it needs an update.
>
>
> "Pucca" < XXXX@XXXXX.COM > wrote in message
> news: XXXX@XXXXX.COM ...
> > Hi, I'm using VS2005, .net 2.0. From my application I poped up a dialog
> > window for user to enter seletction filtering information for retrieving
> > Secruity Log entries. I Now have additional requirement to pop up another
> > dialog window from this one and display a progress bar status on the
> > number
> > of entries I've processed. My question is how can I send the number of
> > entries process periodically to the 2nd dialog window and have it update
> > the
> > progress bar? Thanks.
> >
> > (on the screen, 1st there is my a main window for my application then 2
> > more
> > dialog windows as described above will pop up on top of each other.)
> >
> >
> > --
> > Thanks.
>
>
>
7. Modeless dialog as owner of a modal dialog - CSharp/C#
8. Displaying progress bar status in a dialog of another dialog windo
Multi threading.
You run the progress bar dialog on a second thread and update it via thread
safe calls using invoke to fire a method saftely on the second thread when
it needs an update.
"Pucca" < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...
> Hi, I'm using VS2005, .net 2.0. From my application I poped up a dialog
> window for user to enter seletction filtering information for retrieving
> Secruity Log entries. I Now have additional requirement to pop up another
> dialog window from this one and display a progress bar status on the
> number
> of entries I've processed. My question is how can I send the number of
> entries process periodically to the 2nd dialog window and have it update
> the
> progress bar? Thanks.
>
> (on the screen, 1st there is my a main window for my application then 2
> more
> dialog windows as described above will pop up on top of each other.)
>
>
> --
> Thanks.