| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| Hi all! How can I stopp the execution of an Application until a certain event occurs? e.g. Method pshStart Class Xyz (data or dialog window) Do While TRUE DoAnythink() If !WaitUntilOK() EXIT EndIf If !Continue() EXIT EndIf EndDo Function WaitUntilOK() Local lRet As Logic DO WHILE _lWait // e.g. global variable IF PeekMessage( @msg, 0, 0, 0, PM_REMOVE) TranslateMessage (@msg) DispatchMessage (@msg) ENDIF ENDDO lRet := CheckSomething() Return lRet This Function causes a processor load of 100 %. Is there a better way to realize this function? Regards Gunter |
|
#2
| |||
| |||
| On Thu, 21 Aug 2008 06:35:39 -0700 (PDT), Gunter <g.huebner@dsh-anklam.de> wrote: Hello Gunter, >Hi all! >How can I stopp the execution of an Application until a certain event >occurs? You can set a timer from the dialog you want the waiting to start from: SELF:RegisterTimer( 4, FALSE ) SetTimer(SELF:Handle(), 4, 60000, NULL_PTR) // every minute = 60.000 ms In the windows' dispatch you add: IF (uMsg == WM_TIMER) .AND. (oEvt:wParam == 4) // Timer event 4 ....IF PEEKMESSAGE... ENDIF Don't forget KillTimer(SELF:Handle(), 4) in the window's close Dick van Kooten |
|
#3
| |||
| |||
| Gunter Is the *event* our waiting on an external app. or an internal function of your app?? If external app. look at CreateProcess() in the Win32 API. CYA Steve |
|
#4
| |||
| |||
| A similar problem: is there a way to make my app wait until a report has been printed out to a pdf by the Pdfcreator? At the moment I have a do while -loop checking for the existence of the resulting pdf in the given folder but I would prefer a more fluent solution. Any hints? mot |
|
#5
| |||
| |||
| Marti >A similar problem: is there a way to make my app wait until a report > has been printed out to a pdf by the Pdfcreator? Hard to do if the print spooler is used on the machine as that's the interface for print jobs. I suppose you could try querying the printer via API. If you write your PDF directly to disk it should only take a couple of seconds to ceate the PDF file, in our tests we created ~2000 PDFs (mostly single page statements) in less than 5 minutes. We use a class wrapper I wrote around RP2 and MD_PDF to create them - I should say that ALL our reports are hand coded (i.e. not using the ..RPTs). CYA Steve |
|
#6
| |||
| |||
| On Thu, 21 Aug 2008 23:41:45 -0700 (PDT), martti.toivonen@utu.fi wrote: Hello Martti, >A similar problem: is there a way to make my app wait until a report >has been printed out to a pdf by the Pdfcreator? At the moment I have >a do while -loop checking for the existence of the resulting pdf in >the given folder but I would prefer a more fluent solution. Any hints? I do the same, like this: FOR ni:=1 UPTO 11 // Then we have to wait to make the next PDF until the last one is ready IF File(cPDFPath+cPDFName) // Do we see the created PDF? lok:=TRUE // Done! EXIT // exit for..next, we are ready ENDIF WaitTime(2) // Wait 2 seconds max 10 x I hope that the next ReportPro will solve PDF printing 100% so we won't need PDFCreator anymore. Dick |
|
#7
| |||
| |||
| Hi, the DoAnythink()-function is in fact a print modul that owns a callback-function. This callback-function sends messages if the job is done/sent to the printspooler (not to the printer) or is broken. This messages I can receive und and responde accordingly. But for this time the Application have to wait. Now I let the callback-function set a global variable (_lWait), the WaitUntilOK()-function queries it and stopps the App until this variable ist set by the callback. It is ok so, but it causes a processor load of 100 % so that other processe are constrained. Not a good solution... Gunter |
|
#8
| |||
| |||
| Hi Gunter! Insert Sleep(100) in your loop and try again. Norbert "Gunter" <g.huebner@dsh-anklam.de> schrieb im Newsbeitrag news:030950ab-7d1e-4cf8-8675-c35d9331aa8a@c65g2000hsa.googlegroups.com... > Hi, > the DoAnythink()-function is in fact a print modul that owns a > callback-function. This callback-function sends messages if > the job is done/sent to the printspooler (not to the printer) or is > broken. > This messages I can receive und and responde accordingly. > But for this time the Application have to wait. > Now I let the callback-function set a global variable (_lWait), > the WaitUntilOK()-function queries it and stopps the App > until this variable ist set by the callback. > It is ok so, but it causes a processor load of 100 % > so that other processe are constrained. > Not a good solution... > > Gunter > |
|
#9
| |||
| |||
| Just put: Sleep(40) GetAppObject():Exec(EXECWHILEEVENT) inside the loop -- Ciao Alessandro "Gunter" <g.huebner@dsh-anklam.de> ha scritto nel messaggio news:45502828-ec57-4616-9d0b-7288b7004140@s50g2000hsb.googlegroups.com... > Hi all! > How can I stopp the execution of an Application until a certain event > occurs? > e.g. > Method pshStart Class Xyz (data or dialog window) > Do While TRUE > DoAnythink() > > If !WaitUntilOK() > EXIT > EndIf > > If !Continue() > EXIT > EndIf > > EndDo > > Function WaitUntilOK() > Local lRet As Logic > DO WHILE _lWait // e.g. global variable > IF PeekMessage( @msg, 0, 0, 0, PM_REMOVE) > TranslateMessage (@msg) > DispatchMessage (@msg) > ENDIF > ENDDO > lRet := CheckSomething() > Return lRet > > This Function causes a processor load of 100 %. > Is there a better way to realize this function? > > Regards > Gunter |
|
#10
| |||
| |||
| You could also look at this post of Fabrice Foray and the relative API http://groups.google.it/group/comp.l...5bc64443239148 -- Ciao Alessandro |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.