Hello
I'm trying another solution. I written the following function to
enable/disable the automatic suspend, the suspend is disabled while
the application is doing some measuring
public static void SetSuspendTimeout(int iSecondsTimeout)
{
RegistryKey Key;
Key = OpenNETCF.Win32.Registry.LocalMachine.CreateSubKey(
"\\System\\CurrentControlSet\\Control\\Power\\Timeouts");
Key.SetValue("ACSuspend", iSecondsTimeout);
Key.SetValue("BattSuspend", iSecondsTimeout);
Key.Close();
// Now I would tell to OS to reload the activity timeout
// but it doesn't work. They are applied, of course
// only after a soft reset
FireEvent("PowerManager/ReloadActivityTimeouts");
}
FireEvent is a function written in C++ and it returns me a TRUE value
extern "C" __declspec(dllexport) BOOL FireEvent(TCHAR *sEventName)
{
HANDLE hEvent;
BOOL bResult;
hEvent = CreateEvent(NULL, FALSE, TRUE, sEventName);
if (hEvent == INVALID_HANDLE_VALUE) return(FALSE);
bResult = SetEvent(hEvent);
CloseHandle(hEvent);
return(bResult);
}
Is it correct what I'm doing?
Gianco
Paul G. Tobey said:
What device is it? It sounds like they are not clearing the counter
themselves when user events occur. If that's the case, it seems like
your
only choice is to turn off suspending at all (other than by user
command).
Paul T.
Hello
Yes I'm sure I call this function (each time I call this function in a
timer I increment a value in a label). The settings in the Control
Panel are
Power Properties:
Power scheme ---> AC Power and Battery Power, they have the same
settings
Switch state to User Idle ---> Never (the combo is disabled)
Switch state to System Idle ---> Never (the combo is disabled)
Switch state to Suspend ---> After 5 minutes
What seems strange to me is that the System Idle combo is disabled,
maybe this timer should be set instead of the 'suspend' one, since the
name of the function I would use is SystemIdleTimerReset. Maybe my PDA
doesn't support the System Idle timer?!?! Unfortunately I haven't a
good assistance from our PDA supplier
I tried also to fire keyboard and mouse events calling the keybd_event
and mouse_event functions, and even if I change the mouse position...
nothing to do, the device goes in suspend mode
Is there any other trick to avoid the suspend?
"Paul G. Tobey [eMVP]" <ptobey no spam AT no instrument no spam DOT
com>
wrote in message I've never seen that. Are you really sure you *are* calling it? I'm
guessing that you probably are not. What battery state is the device
in?
What are the time-outs for all situations set to?
Paul T.
Hello
I would avoid the automatic suspend of my PDA in some conditions. I
call the SystemIdleTimerReset function each 5 seconds since this
conditions are true but my PDA goes however in suspend mode after 5
minutes (the suspend time I selected). Is it possible that there's
any
registry voice that disable the functionality of
SystemIdleTimerReset?
Thanks in advance
Gianco