UI events and WM_TIMER MFC

abc abc 351 Reputation points


In MFC Dialog based application, I am calling SetTimer and in ontimer I am calling a function which is a long operation. In the same dialog I have cancel button, If I click cancel button , I need to abort the long operation happening in the ontimer. After going inside the ontimer function, I could not click the cancel button.

How to receive UI events when ontimer is executed?

A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,506 questions
0 comments No comments
{count} votes

Accepted answer
  1. RLWA32 39,806 Reputation points

    The ontimer function is executing on the UI thread. Long operations should be run on a worker thread to prevent them from blocking the user interface.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful