How to turn OFF a pocket pc device?

Discussion in 'Microsoft Dot NET Compact Framework' started by Guest, Aug 7, 2005.

  1. Guest

    Guest Guest

    Hi, How can I turn off a pocket pc device with visual c#.net? I only found a
    solution for embedded visual c++...please help me. Thank you

    juvi
     
    Guest, Aug 7, 2005
    #1
    1. Advertisements

  2. Try this:


    using System.Runtime.InteropServices;
    ....

    [DllImport("coredll.dll")]
    private static extern void PowerOffSystem();


    --
    Sergey Bogdanov [.NET CF MVP, MCSD]
    http://www.sergeybogdanov.com


    juvi wrote:
    > Hi, How can I turn off a pocket pc device with visual c#.net? I only found a
    > solution for embedded visual c++...please help me. Thank you
    >
    > juvi
     
    Sergey Bogdanov, Aug 7, 2005
    #2
    1. Advertisements

  3. Guest

    Guest Guest

    Hi,

    it works, but is it a save way to power off? I tested it on a HP iPAQ
    HX4700. If I power off the device with this code, then you can see the
    display getting darker and darker. If you you use e.g.: Battery Pack Pro to
    power off, then the display is powered off immediately. What do you think
    about this?

    juvi

    "Sergey Bogdanov" wrote:

    > Try this:
    >
    >
    > using System.Runtime.InteropServices;
    > ....
    >
    > [DllImport("coredll.dll")]
    > private static extern void PowerOffSystem();
    >
    >
    > --
    > Sergey Bogdanov [.NET CF MVP, MCSD]
    > http://www.sergeybogdanov.com
    >
    >
    > juvi wrote:
    > > Hi, How can I turn off a pocket pc device with visual c#.net? I only found a
    > > solution for embedded visual c++...please help me. Thank you
    > >
    > > juvi

    >
     
    Guest, Aug 7, 2005
    #3
  4. Well, you may try to turn it off by sending VK_OFF key. After that a
    device will be turned off immediately:


    keybd_event(VK_OFF, 0, 0, 0);
    keybd_event(VK_OFF, 0, KEYEVENTF_KEYUP, 0);


    ....

    const int KEYEVENTF_KEYUP = 2;
    const int VK_OFF = 0xDF;

    [DllImport("coredll.dll")]
    private static extern void keybd_event(byte bVk, byte bScan, int
    dwFlags, int dwExtraInfo);



    --
    Sergey Bogdanov [.NET CF MVP, MCSD]
    http://www.sergeybogdanov.com


    juvi wrote:
    > Hi,
    >
    > it works, but is it a save way to power off? I tested it on a HP iPAQ
    > HX4700. If I power off the device with this code, then you can see the
    > display getting darker and darker. If you you use e.g.: Battery Pack Pro to
    > power off, then the display is powered off immediately. What do you think
    > about this?
    >
    > juvi
    >
    > "Sergey Bogdanov" wrote:
    >
    >
    >>Try this:
    >>
    >>
    >>using System.Runtime.InteropServices;
    >>....
    >>
    >>[DllImport("coredll.dll")]
    >>private static extern void PowerOffSystem();
    >>
    >>
    >>--
    >>Sergey Bogdanov [.NET CF MVP, MCSD]
    >>http://www.sergeybogdanov.com
    >>
    >>
    >>juvi wrote:
    >>
    >>>Hi, How can I turn off a pocket pc device with visual c#.net? I only found a
    >>>solution for embedded visual c++...please help me. Thank you
    >>>
    >>>juvi

    >>
     
    Sergey Bogdanov, Aug 7, 2005
    #4
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Asheesh

    Compact Framework cab files for Pocket PC 2002 and Pocket PC 2003

    Asheesh, Aug 27, 2003, in forum: Microsoft Dot NET Compact Framework
    Replies:
    3
    Views:
    1,095
    Brian Chamberlain [MS]
    Aug 28, 2003
  2. GiuseppeInc

    Download a file from pocket ie to pocket PC folder

    GiuseppeInc, Sep 6, 2003, in forum: Microsoft Dot NET Compact Framework
    Replies:
    0
    Views:
    212
    GiuseppeInc
    Sep 6, 2003
  3. Arnaldo Fuziy

    Turn off, turn on and set time for auto suspending

    Arnaldo Fuziy, Oct 14, 2003, in forum: Microsoft Dot NET Compact Framework
    Replies:
    5
    Views:
    2,169
    Graham McKechnie
    Oct 18, 2003
  4. Razvan Dragomirescu

    Pocket Rendezvous - ad-hoc wireless web server for Pocket PC

    Razvan Dragomirescu, Jun 2, 2004, in forum: Microsoft Dot NET Compact Framework
    Replies:
    0
    Views:
    436
    Razvan Dragomirescu
    Jun 2, 2004
  5. Naveen koul via DotNetMonster.com

    Streaming from pocket pc to pocket pc without any medium(wireless)

    Naveen koul via DotNetMonster.com, May 9, 2005, in forum: Microsoft Dot NET Compact Framework
    Replies:
    1
    Views:
    270
    Paul G. Tobey [eMVP]
    May 9, 2005
Loading...

Share This Page