Multithreading inDelphi

How would you create threads say for scanning for a keypress and something else. I am working on a SCSI app and need to be able to test and interrupt the test at any time. The SRB_ABORT and SRB_EXEC need to run simultaneously. In other words, start reading a disk, then if I choose, press ESC and stop (SRB_ABORT). Right now, if I start a process (Reads, for example) the process locks me out until it completes, so I can not abort. Code snippets please.
evansjAsked:
Who is Participating?
 
ZifNabCommented:
0
 
TheNeilCommented:
Try adding Application.ProcessMessages to your code at regular intervals (or in a loop if that's what you're using). You can then process key presses, set flags, and drop out if you need to. Far simpler than messing around with threads

The Neil
0
 
ZifNabCommented:
Why not looking at the demo in delphi?

{$Delphi}\Demos\threads

Zif
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
niknoxeCommented:
If this hadn't helped you, let me know. Application.ProcessMessages brings you on the right way, but there is a lot more to get them responding!
0
 
bryan7Commented:
listenning
0
 
evansjAuthor Commented:
I'm also reissuing this question for TheNeil so he can get points also.
0
 
TheNeilCommented:
Thanks for the points - don't know if I deserve but you won't hear any complaints (well not from me).

The Neil
0
 
ZifNabCommented:
Thanks for the points - I only hope you have found what you need, because otherwise this was a waste of points. zif.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.