Subj : Re: Dialog painting To : borland.public.cpp.borlandcpp From : Sebastian Ledesma Date : Mon Mar 21 2005 12:38 pm Hi jeff: PumpWaitingMessage is a member of TApplication. In 'pure code functions' you will have to do something like this: myPureCodeFunc() { ..... TWindow *pw=new TWindow(NULL, 0,0); TApplication *pApp=pw->GetApplication(); if (pApp) pApp->PumpWaitingMessages(); delete pw; .... } I dont remeber right now if PumpWaitingMessages was present in older versions of OWL. I learned this way from an older programmer lotta time ago and works in OWL / MFC / plain Win32, etc. I'm not sure if it's the best technique for an OWL application, and if it has some sideeffects / drawbacks, but it works. I use this way when i'm too lazy to implement a thread, only need a two variables to work as semaphor. Typically I do: TMyDialog::OnStartButton(){ processing=1; //allow loop MyLongRunningFunction(); .... } TMyDialog::OnCancelButton(){ processing=0; //cancel loop execution } Saludos Sebastian "Jeff Kish" escribió en el mensaje news:5gnt31p5lljm86kqlg550i16u9vdot9r53@4ax.com... > Wait.. can't you just put a pumpwaitingmessages call into your loop > (if you have one) in your lengthy processing? > > On Mon, 21 Mar 2005 10:06:28 -0300, "Sebastian Ledesma" > wrote: > > >Hello Betkro: > > > >You can do something like this: > > > >void SafeYield() { > > MSG msg; > > if (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) { > > TranslateMessage(&msg); > > DispatchMessage(&msg); > > } > >} > > > >int MyLongRunningFunction(....) { > >static int semaforo; > >if (semaforo) > > return; > >semaforo=1; > > > >while (processing) { > > SafeYield(); > > ... > >} > >semaforo=0; > >return result; > >} > > > >Saludos > >Sebastian > > .