Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Background proccesses within a window

0 views
Skip to first unread message

daniel garcia

unread,
Oct 19, 1995, 3:00:00 AM10/19/95
to
I'm trying to open a dialog which gives a summary about what is happening with a
process that I am running. I'm traversing a directory tree and the current
filename will be updated to the dialog box. I am using OWL 1.0.

The trouble is that all I can program into the system is responses to message.
So what I have done is registered a message and placed it in the dialogs message
queue as the last operation in SetupWindow. I then have a function which processes
that message and when it has done a small amount of work, it places the message
back in the queue and returns.

The problem is that the window won't display until the queue is empty, ie I have
completed processing. Has anyone come across this problem before. How have you
dealt with it.

Daniel Garcia.

Andreas Winter

unread,
Oct 20, 1995, 3:00:00 AM10/20/95
to

Besides: For having a window redrawn *NOW* use UpdateWindow(),

(I'm using OWL2, but the stuff should be similar)

SetupWindow does not Show the Window it created before the function is left,
so you'll have to use ShowWindow(SW_SHOW);

Use a peek-message-loop to do yield processing time to other windows while
you're doing big loops or so:

#define CHECK_IDLE { MSG msg; \
while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) \
{ TranslateMessage(&msg);\
DispatchMessage(&msg); \
}\
}

That would give you a function somehow like this:

void TMyWindow::SetupWindow(void)
{ TDialog::SetupWindow();
ShowWindow(SW_SHOW);
for(long l = 0; l < 1000000; l++) // this is the big
background-processing-loop
{ if(bWindowClosed) // you have to set a flag, when the windows is closed
so you can break the loop
break;
if(l % 1000 == 0) // every now and then, yield control to other
windows
CHECK_IDLE;
}
// you might as well kill the window here
}


Bye, Andi

0 new messages