Solved

changing WM_TIMER priority

Posted on 1997-10-17
3
1,061 Views
Last Modified: 2013-11-20
How can i change message priority's in MFC, is it possible at all?
I don't know why, but WM_TIMER is a low priority message, the timer proc. is called after all other messages are handles.
I have tried already:
1) CWinApp::IsIdleMessage
2) SetWritableTmer as an alternative ( so stupid, the thread has to be in a wait/alertable stat - SleepEx )
3) timeSetEvent as an alternative - it's ok, but i would realy want to change that WM_TIMER priority - no semaphores needed + i already finished a whole lot of code writing, based on WM_TIMER...
thanx  :-o
0
Comment
Question by:shaig
  • 2
3 Comments
 
LVL 3

Author Comment

by:shaig
ID: 1308270
Edited text of question
0
 
LVL 3

Accepted Solution

by:
Melange earned 100 total points
ID: 1308271
The WM_TIMER message has never been guaranteed to be an exact accurate measurement of time. It is only a notification that at LEAST the required interval has passed. For example, if you have a timer for 1 second intervals and then decide to do a thread eating 5 second process you will NOT receive 5 different timer messages when you resume processing messages. You will only get 1.

The way WM_TIMER works is that when the interval has passed, Windows sets a flag in your message queue. When the last message is processed in your queue, Windows checks this flag and then decides that it should either send you a WM_TIMER or call your TimerProc (depends on how you used the SetTimer call).

If you truly need something that is near 100% accurate on time intervals, then you will need to use something else, preferably a second thread that does the time critical process.

0
 
LVL 3

Author Comment

by:shaig
ID: 1308272
The stuff about "eating cpu for 5 seconds..." is obvious, but why the hell is this message handled last?
Is there such a thing called a "message priority"?
Is the source code of the section you descried available anyware?
Since the timer event has to be processed by one praticular thread, another thread won't help because it will have to wait for the first one to have time for it anyway ( event's pass only when a thread is in that stupid alertable wait stat ).
Is there a way to signal  ( interrupt ) a thread without having it put to sleep ( or to SleepEx if to be exact ) ?
thank you very much for responding, sorry for beeing such a pian  in the butt, oh... and sorry for my poor english.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now