PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Stop automatic power off of a Pocket-PC ?

directdance · 17 Jul 2006, 08:48 UTC
Hi,

is there a possibility to stop the automatic "power off" function of a pocket pc using PPL? I mean the function, if you do not hit any key, the ppc is going into standby, wich is worse for my new project.

Btw., if it has gone into standby, after pressing the power on button, the sound engine is crashing ...

Thanks,
DirectDance
directdance · 18 Jul 2006, 08:44 UTC
... I have found a WinApi function, SystemIdleTimerReset wich has to be called every minute for preventing shutting down the PPC.

Is it possible to call a WinApi function using PPL?

And if so, it would be very nice if anybody can give me an example ;-)

Many thanks,
DirectDance
PointOfLight · 18 Jul 2006, 12:31 UTC
You want to do the following -

#declare SystemIdleTimerReset "dllname.dll" SystemIdleTimerReset #InputParams #OutputParms

or

#declareapi {everything else the same}

I will be perfectly honest in that I don't know what the difference between #declare and #declareapi is, but one of those should work for you. I hope this makes sense.
directdance · 18 Jul 2006, 13:35 UTC
Hi there,

thanks for your hint, but my problem is, that the function SystemIdleTimerReset is a content of the winapi. I do not know a dll file. Is it possible, that the winapi is always loaded like a standard api?

Sorry, I do not really have skills in this :cry:

Thanks,
DirectDance
PointOfLight · 18 Jul 2006, 14:08 UTC
Try this then. Instead of putting a dll name in quotes, just put the term apidll and see if that works. So,

#declare FuncName apidll FuncName Input Output
directdance · 18 Jul 2006, 14:30 UTC
Hmmm...

How do I have to call the function? I did this:

Code:

// Default Advanced Game API skeleton

#include "GameAPI.ppl"
#declare SystemIdleTimerReset apidll SystemIdleTimerReset 0 0
.
.
.
SystemIdleTimerReset;



but I am getting:

Syntax error at 'SYSTEMIDLETIMERRESET' (3636,7)
PointOfLight · 18 Jul 2006, 14:45 UTC
Try changing it to #declareapi. I wish I could be of more practical help but I can't test it myself right now. It looks like you're calling it correctly.
directdance · 18 Jul 2006, 14:50 UTC
I have tried this allready, but it did not work either ...

Anyway, thanks for your help!

I found on a web site (opennetcf.org): Declare Sub SystemIdleTimerReset Lib "coredll" ()


But even when I change the apidll to coredll, nothing changed.

Cheers,
DirectDance
PointOfLight · 18 Jul 2006, 15:52 UTC
Okay, I gave this a whirl, and this is what I came up with:

Code:

#declareapi SystemIdleTimerReset "coredll" SystemIdleTimerReset 0 0


I don't know if it does anything, but I don't get an error either. Let me know if it works for you.
It's not finding the function in the dll or the dll name is not used correctly.

Code:
#declare SystemIdleTimerReset apidll SystemIdleTimerReset 0 0


This should work.
directdance · 18 Jul 2006, 20:01 UTC — It is working now!
Thanks to both of you ! So, PointOfLight your second idea, using the apidll was correct. It was my mistake ..., I am stupid!

I tested (like everytime i am using PPL) on my desktop pc and of course, my desktop pc does not know this command because it is for a ppc. Compiling the source on my ppc returned in no errors.

Thanks a lot !!!

Btw., Kornalius, please hurry up with the release of PPL. I just want to spend some money :lol:

Cheers,
DirectDance
PointOfLight · 18 Jul 2006, 20:05 UTC
Actually, the holdup on the release is my fault. But that's a bit off topic...

Anyway, here's a conditional that's definitely your friend when writing for multiple platforms:

Code:

#ifdef _WIN32_WCE
.
//code here
.
#endif


Surround PPC only code with these flags to make sure they don't error when you run it on the PC.
Yep, #ifdef #endif is really your friend for multiplatform development.
I just wanted to throw my 2 bits in...

As POL stated earlier in the post, you use #declare:
Code:
#declare PPL_Alias DLL_Name Win32API_Name #InputParams #OutputParms


You can use this to call an API function that hasn't been declared yet. Most declares are in Windows.PPL. The DLL_Name parameter has alias set up so that when switching platforms the different DLL names among platforms can be taken into account. You can find these names declared in DEFS.PPL.

The #declareapi keyword solves a similar platform problem. Using SetWindowsText as an example. Look in Windows.ppl and you'll see:
Code:
#declareapi SetWindowText apidll SetWindowText 2 1


The PPC uses Unicode text and XP uses Ascii text. The function calls are different. Windows accomplishes this by having 2 functions SetWindowTextW and SetWindowTextA. A macro exists to map the function you need to SetWindowText. In PPL, this is done by #declareapi. It really looks for SetWindowTextW on the PPC and SetWindowTextA on the desktop.

This would be great info for the manual POL.

I will try to get this into the FAQ.

bmanske
PointOfLight · 19 Jul 2006, 17:59 UTC
bmanske: once you've written it up for the FAQ, can you send me the text? I'll use that as the basis for what I add to the help file. Thanks.
Hey Brad,

Thanks for taking the time to post this important information.

Can you write it up in the FAQ on arianesoft.ca? Contact for your first time posting an FAQ there.