Recent

Author Topic: Reboot PDA  (Read 7195 times)

fjtrooper

  • New Member
  • *
  • Posts: 12
Reboot PDA
« on: August 21, 2009, 08:27:35 am »
Good morning,

anyone knows how to reboot PDA by code?

Thanks

fjtrooper

  • New Member
  • *
  • Posts: 12
Re: Reboot PDA [SOLVED[
« Reply #1 on: August 24, 2009, 09:00:12 am »
Finally I've solved it. Here's the code:

function ExitWindowsEx(dwFlags: DWord;dwReason: DWord): WINBOOL;  stdcall; external 'aygshell.dll' name 'ExitWindowsEx';

//dwReason ; always 0
//dwflags ;  2 for reboot, 8 for shutdown

Thanks

BlueIcaro

  • Hero Member
  • *****
  • Posts: 792
    • Blog personal
Re: Reboot PDA
« Reply #2 on: August 24, 2009, 03:38:16 pm »
Please can you write it at: http://wiki.lazarus.freepascal.org/index.php?title=WinCE_Programming_Tips
Here we can all tips on a page
/BlueIcaro

picstart

  • Full Member
  • ***
  • Posts: 236
Re: Reboot PDA
« Reply #3 on: August 24, 2009, 08:05:57 pm »
function ExitWindowsEx(dwFlags: DWord;dwReason: DWord): WINBOOL;  stdcall; external 'aygshell.dll' name 'ExitWindowsEx';

//dwReason ; always 0
//dwflags ;  2 for reboot, 8 for shutdown

I tried the above with WINCE 4.2 net and it fails with message not a vaild windows application.

The code below partially works  Eg reset works and suspend probably works but I can't get the system out of suspend to prove it.

const
  //some of consts already found in Windows
  POWER_STATE_ON    =   $00010000;
  POWER_STATE_OFF     =   $00020000;
  POWER_STATE_SUSPEND = $00200000;
  POWER_STATE_RESET   = $00800000;
  POWER_FORCE = 4096;       

function SetSystemPowerState(psState: PWideChar; StateFlags: DWORD; Options : DWORD):DWORD;
 stdcall; external 'coredll.dll' name 'SetSystemPowerState';

Ex usage
SetSystemPowerState(nil, POWER_STATE_SUSPEND, POWER_FORCE);

fjtrooper

  • New Member
  • *
  • Posts: 12
Re: Reboot PDA
« Reply #4 on: August 25, 2009, 12:31:26 pm »
I've tried it in WM6 and works perfectly.

 

TinyPortal © 2005-2018