I've not looked at your source, but hopefully got the 'jist' of what you are trying to do.
A couple of methods I could suggest would be to have your callback execute the measurement code in a seperate thread. You could disable the button to launch that test once entering the new thread. You new thread performing the measurement could then check periodically a variable / flag indicating whether or not an exit from the measurement was requested.
Since the thread would be executing in parallel to the user interface callbacks, the action of say pressing an abort button could set this flag. The thread would detect this, terminate and un-dim the control that started the measurement (and performing any cleanup required).
A more simple method without the thread aspect, would be to include at regular intervals throughout your measurement callback to include a few ProcessEvents calls.
I am assuming that within your measurement code (perhaps I should have opened your code), that it continues until finished.
If say your exit callback (could be your main Call backs function) set a flag, and within your measurements code you checked for that flag it would require to ProcessEvents call to allow that code to execute.
If your measurements code for example was a for loop from 1 to 1 billion, it would execute in its entirety before any user events were actioned. But the placing of a ProcessEvents within your loop would allow the User Interface callbacks to be executed and thus you could update a flag in here.
The disadvantage of the second method over the thread method is that say you called an external function called getMeasurement that you had no control over, you would still have to wait the finite period for that function to complete execution before stopping the measurement, by which time it has already finished.
Using a thread method you can effectively kill the thread at your own discression as and when required (performing the necessary clean up functions)
Hope this helps more than confuses, if you need me to go any further, just give drop me a mail (chris.a.wright@motorola.com) or via this list.