Child Windows (HELP HELP HELP)

Child Windows (HELP HELP HELP)

Post by Mike Goelz » Thu, 16 Jun 1994 08:20:17



Intended for comp.os.ms-windows.programmer.misc newsgroup.

HELP!  This ones driving me crazy.  Ok, I create a child window of class
PauseWindow (which I defined), and which does nothing more than display a
static control in the middle that says "Please wait."  Real simple,
right.  Ok, so once the window is displaying that static, the program is
supposed to post a user defined message which calls a function that sorts an
array, blah, blah, blah.  The way I have this setup is at the end of
PauseChild_OnCreate, there is a "PostMessage(GetParent(hwnd),WM_SORT,0,0)"
where WM_SORT is my message, and the GetParent(hwnd) thing yeilds a handle
to the main window.  But the problem is that the message is being send
before the child window is being drawn, the result being that there is an
empty white square on the screen while the 60-second sort goes on, and its
message is only displayed to the user once the sort is through, by which
time it is time to close the window anyway.  If anybody knows a way to
cause a message NOT to be processed until the static control in the center
of a child window is drawn, PLEASE TELL ME!  Or, if you have some working
code to illustrate this, please post it.  Thanks.

 
 
 

Child Windows (HELP HELP HELP)

Post by Ron Klatch » Thu, 16 Jun 1994 09:16:33


: HELP!  This ones driving me crazy.  Ok, I create a child window of class
: PauseWindow (which I defined), and which does nothing more than display a
: static control in the middle that says "Please wait."  Real simple,
: right.  Ok, so once the window is displaying that static, the program is
: supposed to post a user defined message which calls a function that sorts an
: array, blah, blah, blah.  The way I have this setup is at the end of
: PauseChild_OnCreate, there is a "PostMessage(GetParent(hwnd),WM_SORT,0,0)"
: where WM_SORT is my message, and the GetParent(hwnd) thing yeilds a handle
: to the main window.  But the problem is that the message is being send
: before the child window is being drawn,

A window is created and then it is displayed.  So, you are doing you
PostMessage() too soon.  Instead of posting the message while
handling WM_CREATE (OnCreate() function), why don't you post a
message from the function that creates the window.

    CreateWindow( ... );
    UpdateWindow( hWnd );
    PostMessage( ... );

Since UpdateWindow() forces the window to paint, you will not
initiate the operation until the window is displayed.  Furthremore,
since the window doesn't know anything about the operation being
performed, it will be easier to reuse in the future.

moo
--
----------------------------+-----------------------------------------------
Ron Klatchko                |  You need God, the sign says,


 
 
 

Child Windows (HELP HELP HELP)

Post by Kit Kauffma » Thu, 16 Jun 1994 23:37:07



>Intended for comp.os.ms-windows.programmer.misc newsgroup.
>HELP!  This ones driving me crazy.  Ok, I create a child window of class
>PauseWindow (which I defined), and which does nothing more than display a
>static control in the middle that says "Please wait."  Real simple,
>right.  Ok, so once the window is displaying that static, the program is
>supposed to post a user defined message which calls a function that sorts an
>array, blah, blah, blah.  The way I have this setup is at the end of
>PauseChild_OnCreate, there is a "PostMessage(GetParent(hwnd),WM_SORT,0,0)"
>where WM_SORT is my message, and the GetParent(hwnd) thing yeilds a handle
>to the main window.  But the problem is that the message is being send
>before the child window is being drawn, the result being that there is an
>empty white square on the screen while the 60-second sort goes on, and its
>message is only displayed to the user once the sort is through, by which
>time it is time to close the window anyway.  If anybody knows a way to
>cause a message NOT to be processed until the static control in the center
>of a child window is drawn, PLEASE TELL ME!  Or, if you have some working
>code to illustrate this, please post it.  Thanks.

Well, what you want is for the sort to happen after the first WM_PAINT, so why
not just wait for that, and post your WM_SORT message (only the first time)?

Seizure later,


                73363,447 (Compu$erve)
                (801) 277-5790

 
 
 

1. Child windows (HELP HELP HELP)

Ron (and everybody)-

Thanks for responding to my post.  Unfortunately, I tried your suggestion
with no luck.  Now the Windows seems to be swallowing the message without
a trace.  

Basically, the window is created w/ a CreateWindow() call in a function
called Shuffle().  Then the window is created, and according to my
debugger, the window procedure (ChildWndProc) takes over for a bit.  Any,
back to Shuffle(), the next line is a MessageBox just to test to make sure
that the program has returned from ChildWndProc.  This message box is
always displayed. Immediately afterward is the
PostMessage(GetParent(hwnd),WM_SORT,0,0).  That's it for Shuffle().  So
presumeable WM_SORT should execute, but it doesn't.  I've elilenated the
obvious.  I know that the WM_SORT function/message/whatever does work
because when called from different places it does do the sort.  But beyond
that I don't have a clue what's going on.  ANY SUGGESTIONS FROM ANYONE?
PLEASE?

2. Gvim and windows help files

3. HELP!!!HELP!!!HELP!!!HELP!!!HELP!!!HELP!!!HELP!!!HELP!!!HELP!!!HELP!!!

4. desktop issue

5. Child windows within MDI children-help!

6. Adviced needed for UMAX scanner

7. HELP HELP - WSANO_DATA what does this really mean HELP HELP????

8. Can i Edit $searchForm?

9. HELP!!!HELP!!!HELP!!!HELP!!!HELP!!!

10. Help on help : How to link fromPopup to normal help window

11. HELP HELP HELP HELP HELP HELP ... Did I mention that I need HELP?????

12. Simple Windows API Child Windows... Help...

13. HELP: Problem maximizing a Windows help window