1

Topic: SetTimer: how to learn, whether the timer is launched?

At some moments of time on hWnd the timer can be hung up:
SetTimer (hWnd, ID_TIMER, pause, 0);
Which through the specified time interval sends to procedure
LRESULT SearchResultImportProcessDlg:: WndProc (UINT wMsg, WPARAM wParam, LPARAM lParam)
The message
WM_TIMER, in it by the first line I do KillTimer (hWnd, ID_TIMER);
The user presses the button. During this moment it is important to understand, whether the timer at the moment of button click worked?

2

Re: SetTimer: how to learn, whether the timer is launched?

I agree wrote:

During this moment important to understand, whether the timer at the moment of button click worked?

What means "worked" in your understanding? Has been caused SetTimer ()? It is identified on ,
Which this function returns also which it is possible to nullify after call KillTimer ().

3

Re: SetTimer: how to learn, whether the timer is launched?

Works  with difficult logic. From time to time pauses are necessary - someone there somewhere there causes SetTimer for half-minute, and in WM_TIMER is caused killtimer and function which continues the analysis in a logic jungle.
The user presses the button, the handler function of pushing the button is caused. And here during this moment well to understand - how to identify on  windows, whether has been caused SetTimer?

4

Re: SetTimer: how to learn, whether the timer is launched?

What hinders to implement volatile a flag of operation of the timer and to change it from any place only through InterlockedCompareExchange?

5

Re: SetTimer: how to learn, whether the timer is launched?

rdb_dev wrote:

That hinders to implement volatile a flag of operation of the timer and to change it from any place only through InterlockedCompareExchange?

> volatile
It all the same that is hands today. Is std:: atomic_flag

6

Re: SetTimer: how to learn, whether the timer is launched?

I agree wrote:

Works  with difficult logic. From time to time pauses are necessary - someone there somewhere there causes SetTimer for half-minute, and in WM_TIMER is caused killtimer and function which continues the analysis in a logic jungle.
The user presses the button, the handler function of pushing the button is caused. And here during this moment well to understand - how to identify on  windows, whether has been caused SetTimer?

by means of SetProp hang up a sign

7

Re: SetTimer: how to learn, whether the timer is launched?

NekZ;
For  (WM_TIMER) the timer it is excessive

8

Re: SetTimer: how to learn, whether the timer is launched?

NekZ wrote:

> volatile
It all the same that is hands today. Is std:: atomic_flag

Yes though as! The essence from it does not change.

9

Re: SetTimer: how to learn, whether the timer is launched?

I agree wrote:

From time to time pauses are necessary

"Already ridiculously." ()
Tire out the difficult logic in a background thread and not  to itself a brain with the timer.

10

Re: SetTimer: how to learn, whether the timer is launched?

, I understood.
It is necessary std:: mutex that OR to allow to work timer functions, OR to allow to work to the output agent of the button.

11

Re: SetTimer: how to learn, whether the timer is launched?

CEMb wrote:

It is necessary std:: mutex that OR to allow to work timer functions, OR to allow to work to the output agent
Buttons.

They and so in one flow. Parallel performance is impossible on determination.

12

Re: SetTimer: how to learn, whether the timer is launched?

I agree wrote:

During some moments of time on hWnd the timer can be hung up:
SetTimer (hWnd, ID_TIMER, pause, 0);
Which through the specified time interval sends to procedure
LRESULT SearchResultImportProcessDlg:: WndProc (UINT wMsg, WPARAM wParam, LPARAM lParam)
The message
WM_TIMER, in it by the first line I do KillTimer (hWnd, ID_TIMER);
The user presses the button. During this moment it is important to understand, whether the timer at the moment of button click worked?

The logic of actions, here timer singularities is not absolutely clear:
KillTimer returns result. "Funny", but if the timer is not installed to a window, False
Killed the timer does not mean that the message is not sent not so (it by the way ) and it can quite be in flow queue
To beat out the message from queue it is possible with the help PeekMessage