Page 1 of 1

PostPosted: Thu Mar 15, 2001 3:40 pm
by BobShen
Hi everyone:
I made an applet. I want it to keep running and ignore OS auto-off
power. I used
regwint(2, "SYSTEM\\CurrentControlSet\\Control\\Power", "BattPowerOff", 600)
to change suspend time.But WinCE v2.11 still auto-off power after
5 minute.Why? I figure out that recently. In my power setting dialog,
the max suspend time item is 5 minute on that combobox.If I set 600 seconds
(10 minutes) to Registry.There wasn't 10 minutes item on the combobox.
WinCE v2.11 will ignore my setting value,and keep using 5 minute's suspend
time.Even I used registry editor to change suspend time over 5 minutes.
It still didn't work.

So, I was thinking that my applet send arbitrary messages or events after
4' 59.999" idle time, like BUTTONUP or KEYUP, to notify WinCE that the
system is not idle. If it work, my applet will get another 5 minutes suspend
time. Is it possible? Which PocketC API should I use?

Another way is to intercept the message that notify WinCE the system
have be idle 5 minutes.Personally, I think it more difficult than above.

PostPosted: Fri Mar 16, 2001 2:38 pm
by airdrik
I would think that if you did a keyevent every almost 5 minutes that should keep it from suspending. I have been able to send key strokes to a program that I opened in one of my applets using that, so likely it will work for keeping the system on.

PostPosted: Fri Mar 16, 2001 3:18 pm
by Justinespinosa
If you want your settings to take effect, you must tell the system to re-read the settings from the registry. I don't even know if you can do that with pocketC (and i don't think so). But the only way i have to change the settings from a registry editor is to perform a soft reset


OUTS Softwares

PostPosted: Fri Mar 16, 2001 10:14 pm
by BobShen
Hi airdrik:
How did you do that?I noted your post 3/16,about penevent function.You seem succeeded.
Could you send some source code about that?

PostPosted: Fri Mar 16, 2001 10:28 pm
by BobShen
Hi airdrik:
The keyevent() document I really can't
follow it.Could you send some code about that.
For example,I would like send a "Up" key stroke
to system.How did you do that?

PostPosted: Sat Mar 17, 2001 3:17 pm
by Justinespinosa
simulate an arrow key:

Down: 40
left: 37
right: 39
key down:
key up:

but i can't find the value of KEYEVENTF_KEYUP in pcheader.h you must ask kevin


OUTS Softwares

PostPosted: Sun Mar 18, 2001 5:35 am
by BobShen
Thanks Justinespinosa. I'll give it a try,and tell you result.

Thanks again!!!

PostPosted: Mon Feb 28, 2005 10:39 pm
by danhass
I got here searching for some related help. I have an application (written in C++) that uses some telephony archetecture to sync up dbs. In general, we want our hand held devices to auto-shutoff at 60 secs except during the syncing. My app sets the HKEY_LOCAL_MACHINE.System.CurrentControlSet.Control.Power.BattPowerOff to 0 (disabling) during the syncing, and then restores it to 60 after syncing, but the hand helds device still shut off after 60 seconds even when syncing. Is there an API call or some other mechanism that needs to be called to "pick up" the registry changes once they are set?