Hello,
I am developing a HAM radio digital modes chat-like software, which
uses sound input and output as a modem.
The application is for free at http://pocketdigi.sourceforge.net
Some of the digital signal processing methods are quite CPU intensive.
User may select mode, for which the CPU power is not sufficient. In
worst case the waveIn messages are processed first, there will be no
idle times so WM_PAINT will never be sent and the application will
respond to user interaction extremely slowly if at all. I would like
to detect this case and offer the user to switch to a less CPU
intensive mode.
My application is pure Win32 written in C. My first attempt was to
detect cases when the main message loop does not idle for a long time.
This seems to work quite well, but fails when I open a message box.
System function DialogBox creates its own message loop and my
detection of Idle state does not work anymore. I believe writing a
custom replacement of DialogBox will work, but I am a bit worried that
some dialog functions like common accelerators will not work. I expect
troubles with Smartphones. On Desktop there are message hooks, but on
Windows CE they are not officially supported.
The other idea was to measure time the messages (mainly the waveIn
messages) spend in application message queue. MSG structure contains
time member. The idea was to compare MSG.time with GetTickCount().
This solution has the same problem. DialogBox creates its own message
loop, over I have no control. After the messages are dispatched,
MSG.time is no more available at window functions.
The other idea is to use GetIdleTime(). Unfortunatelly this function
is not officially supported by Windows CE. I know the function is
there in coredll.dll, but I do not want to risk that my application
will not work on some devices.
Thanks in forward for any hint.
Vojtech