Software Archive
Read-only legacy content
Announcements
FPGA community forums and blogs have moved to the Altera Community. Existing Intel Community members can sign in with their current credentials.
17060 Discussions

Peekcharqq in DLL

bdrichards
Beginner
742 Views
I am using a call to PEEKCHARQQ in a DLL function (that's called from Delphi) inside of a DO WHILE loop to, hopefully, trap a keystroke such as ESC to end the loop, yet the call ALWAYS returns false, as if nothing is ever in the keyboard buffer. Should PEEKCHARQQ not be used inside of a DLL?
Bill
0 Kudos
2 Replies
Jugoslav_Dujic
Valued Contributor II
742 Views
According to docs, PEEKCHARQQ Checks the keystroke buffer for a recent console keystroke . My reading is that it will work only for applications with console (either real or "overloaded" as in QuickWin). A better way would be to use PeekMessage(...WM_KEYDOWN), or, still better, to use synchronization objects and let the caller decide how to interrupt the calculation if necessary. See ThreadDlg sample for an illustration of the technique.

HTH
Jugoslav
0 Kudos
bdrichards
Beginner
742 Views
Right! thanks. PeekMessage is the answer. As a Fortran "old timer" I can't get used to there not being a console all the time.
BILL
0 Kudos
Reply