Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Mobile Development
  3. Mobile
  4. How to programaticaly switch from suspend mode to power on mode in windows mobile

How to programaticaly switch from suspend mode to power on mode in windows mobile

Scheduled Pinned Locked Moved Mobile
tutorial
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    anuhoho
    wrote on last edited by
    #1

    Hi I want to make an application which can detect when my device is going to the sleep mode and then it will immediately on the device. I tried a little bit but in vain Let me show what i tried. Actually i am creating a thread which will try to detect when my device is going to the suspended state then it will try to power on .My logic is in this way but the functions i might be using may be a matter of concerned. Need guidance in that

    In the WinAPI I am starting the thread
    ..
    //Create a thread
    m_hThread = CreateThread(NULL, 0, ThreadProc, NULL, 0, NULL);
    ...

    And in the thread function I am doing this

    DWORD ThreadProc(LPVOID lpParameter)
    {
    LPWSTR pBuffer = NULL;
    PDWORD pdwFlags = NULL ;
    DWORD iState = NULL;
    while(TRUE)
    {
    iState = GetSystemPowerState(pBuffer,sizeof(pBuffer),pdwFlags);
    if(iState == POWER_STATE_SUSPEND)
    {
    SetSystemPowerState(NULL,POWER_STATE_ON,POWER_FORCE);
    return 1;
    }

    }
    

    return 0;
    }

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups