Click here to Skip to main content
15,906,567 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralPop-up Menu Pin
Rage6-Oct-04 2:03
professionalRage6-Oct-04 2:03 
GeneralRe: Pop-up Menu Pin
Garth Watkins6-Oct-04 2:51
Garth Watkins6-Oct-04 2:51 
GeneralRe: Pop-up Menu Pin
Rage6-Oct-04 3:59
professionalRage6-Oct-04 3:59 
GeneralRe: Pop-up Menu Pin
Iain Clarke, Warrior Programmer6-Oct-04 4:54
Iain Clarke, Warrior Programmer6-Oct-04 4:54 
GeneralRe: Pop-up Menu Pin
Rage6-Oct-04 21:07
professionalRage6-Oct-04 21:07 
GeneralProble with OnTimer() Pin
Leyu6-Oct-04 1:36
Leyu6-Oct-04 1:36 
GeneralRe: Proble with OnTimer() Pin
toxcct6-Oct-04 1:57
toxcct6-Oct-04 1:57 
GeneralRe: Proble with OnTimer() Pin
Nathan Holt at EMOM6-Oct-04 5:28
Nathan Holt at EMOM6-Oct-04 5:28 
leyusha wrote:
The OnTimer() function , which is called after a timer is created by SetTimer (),is processed when there is no other message to be processed. I wanted to make a second by second update to my program but it fails as when the user clicks very fast or if many messages are sent by the user or the program.
How can make a second by second update (a timer that will always get exact count)or ; make the WM_TIMER message to have higher priority


You didn't mention how exact the count needs to be, so I should mention that you aren't ever going to get milisecond accuracy. However, it's quite possible that you can display an update so that the user sees something new about every second.

Another issue it that paint messages have an even lower priority than timer messages. If your program has long periods in which no timer messages get through, then no paint messages will get through either. This can lead to things like message boxes not being displayed, leaving the user wondering why your program has stoped responding. Because of this, the best solution is probably just to make your message handling efficient enough that timer messages can get through in a reasonable amount of time.

That being said, you can effectively make higher priority timer messages by having a background thread wait on timer messages or a waitable timer object, and having the thread send a WM_COMMAND or a custom message that will have normal priority. If the background thread doesn't do anything else, you can safely raise the thread's priority to get a bit more accuracy.

Nathan Holt
GeneralRe: Proble with OnTimer() Pin
toxcct6-Oct-04 6:35
toxcct6-Oct-04 6:35 
GeneralRe: Proble with OnTimer() Pin
Nathan Holt at EMOM6-Oct-04 7:02
Nathan Holt at EMOM6-Oct-04 7:02 
GeneralRe: Proble with OnTimer() Pin
Iain Clarke, Warrior Programmer6-Oct-04 5:32
Iain Clarke, Warrior Programmer6-Oct-04 5:32 
GeneralRe: Proble with OnTimer() Pin
LittleYellowBird6-Oct-04 5:36
LittleYellowBird6-Oct-04 5:36 
GeneralRe: Proble with OnTimer() Pin
Leyu6-Oct-04 8:01
Leyu6-Oct-04 8:01 
GeneralRe: Proble with OnTimer() Pin
BlackDice6-Oct-04 10:59
BlackDice6-Oct-04 10:59 
Generalexe file not run properly out side of vc++ environment Pin
nirmit6-Oct-04 1:09
nirmit6-Oct-04 1:09 
GeneralRe: exe file not run properly out side of vc++ environment Pin
toxcct6-Oct-04 1:25
toxcct6-Oct-04 1:25 
GeneralRe: exe file not run properly out side of vc++ environment Pin
nirmit6-Oct-04 2:54
nirmit6-Oct-04 2:54 
GeneralRe: exe file not run properly out side of vc++ environment Pin
David Crow6-Oct-04 4:03
David Crow6-Oct-04 4:03 
GeneralRe: exe file not run properly out side of vc++ environment Pin
toxcct6-Oct-04 6:26
toxcct6-Oct-04 6:26 
GeneralRe: exe file not run properly out side of vc++ environment Pin
Sujan Christo6-Oct-04 1:26
Sujan Christo6-Oct-04 1:26 
QuestionHow to create a custom fonts Pin
Azghar Hussain6-Oct-04 0:54
professionalAzghar Hussain6-Oct-04 0:54 
GeneralRe-draw A ListCtrl Pin
sweep1236-Oct-04 0:34
sweep1236-Oct-04 0:34 
GeneralRe: Re-draw A ListCtrl Pin
Rage6-Oct-04 2:12
professionalRage6-Oct-04 2:12 
GeneralCOM Handler Pin
sampal5-Oct-04 23:27
sampal5-Oct-04 23:27 
GeneralRe: COM Handler Pin
Sujan Christo6-Oct-04 0:41
Sujan Christo6-Oct-04 0:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.