flat assembler
Message board for the users of flat assembler.

Index > Windows > How windows execute settimer ?

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1807
Roman 16 Jul 2022, 11:16
Windows 10 64 bits. My processor AMD Ryzen 3500 CPU Cores 6
I not understood how work settimer(callback proc) on CPU.
callback proc run on threads ?
Or one core ?

I try settimer and set my proc.
Code:
invoke  SetTimer,0,16,1100,Timerproc
proc Timerproc HWND,uint1,uint2,uint3
     invoke MessageBox,0,.txt ,0,0
     ret
.txt db 'buttn Timerproc0',0,0
endp
    

I thinked Timerproc run and wait when i press ok.
But i get many message boxes.
Its confused me.
And i not understood how exactly work settimer.
Post 16 Jul 2022, 11:16
View user's profile Send private message Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 978
Location: Russia
macomics 16 Jul 2022, 11:54
To block the execution of the program, MessageBox starts its own message processing cycle.

SetTimer adds the trigger time to the array/waiting list in chronological order and, with each timer interrupt, the handler checks the first element of this array/list for triggering. If it worked, a message from the timer is added to the message queue.

The first message on the timer selects your message processing cycle, and the rest - the message processing cycle of the last MessageBox shown.

To prevent such an effect, it is worth stopping the timer for the duration of its function or creating an execution flag (Event/Critical section, etc.)
Post 16 Jul 2022, 11:54
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.