UI events and WM_TIMER MFC

abc abc 351 Reputation points
2020-12-16T12:16:31.06+00:00

Hi,

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?

C++
C++
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
    2020-12-16T13:00:23.64+00:00

    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