Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Stop a scan
Message
De
28/02/2013 09:16:15
 
 
À
28/02/2013 08:37:29
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
01567088
Message ID:
01567135
Vues:
64
>>>VFP9SP2
>>>I would like to conditionaly stop a scan. The easiest way would be to {set escape on} and invoke the ESC key. However the application rules that 'settings' should not be used. Do we have an other option?
>>
>>
>>Launch a separate process which presents a form with a "Cancel operation" button. Use BindEvent() to send messages back and forth to each other's HWND. Every 10th or 100th iteration on your SCAN, do a DOEVENTS (or DOEVENTS FORCE). Pass the HWND value of your first form as a command line parameter to the called process. It will use BindEvent() on custom messages you'll send from the first/master process. The first thing it does after loading is send a message back saying "I'm up and running," and then you can have two way communication. When your SCAN..ENDSCAN block completes, send it the terminate message to close the separate process. If the user clicks the "Cancel operation" button, send your SCAN..ENDSCAN process the "the user wants to cease" operation.
>>
>>You can see a sample of how this works: https://github.com/RickCHodgin/guithread
>>
>>To run, go to the "master" directory and type "do go".
>
>This seems over complicated.
>
>I have a simple modeless form with a Cancel button and lCancelled property.
>
>I create the form before the scan, for each iteration of the scan I call DoEvents and check the form's lCancelled property, and close the form after the scan (whether cancelled or not)
>
>Actually, the form has a progressbar bar which I update along the way.
>
>All this courtesy of Matt Slay as part of GoFish.

Jim,

I fully agree with you.
I am doing it the same way as you, except that I missed the DoEvents with that it works fine. A little drawback: DoEvents penalizes the speed. Meanwhile have found an article in Wikis "Fast Do Events" by David Frankenbach, that seems to solve that as well. Will investigate.

Koen
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform