How to Soft Reset a Device programatically

Dear all,

Is there any command in VB to Soft Reset the device Please give an advice. Thank you!



Answer this question

How to Soft Reset a Device programatically

  • C.K. Chua

    Hi

    Call the Win32 API SetSystemPowerState to reset the device

    Declare the Function as folllowed:
    Const POWER_STATE_RESET As Integer = &H800000
    <DllImport("coredll")> _
    Private Shared Function SetSystemPowerState(ByVal psState As String, ByVal StateFlags As Integer, ByVal Options As Integer) As
    Integer
    End Function

    To Reset the Device call:
    SetSystemPowerState (Nothing, POWER_STATE_RESET, 0)

    This should work on any Windows Mobile 2003 and Windows Mobile 5.0 Devices.

    Thanks!
    Michael



  • Arex

    Hi
    You need do add an Imports statement at the very beginning of the file.

    Add the following line at the very beginning of your .vb file:
    Imports System.Runtime.InteropServices

    Thanks!
    Michael



  • Louisb

     Michael Koster wrote:

    Hi

    Call the Win32 API SetSystemPowerState to reset the device

    Declare the Function as folllowed:
    Const POWER_STATE_RESET As Integer = &H800000
    <DllImport("coredll")> _
    Private Shared Function SetSystemPowerState(ByVal psState As String, ByVal StateFlags As Integer, ByVal Options As Integer) As
    Integer
    End Function

    To Reset the Device call:
    SetSystemPowerState (Nothing, POWER_STATE_RESET, 0)

    This should work on any Windows Mobile 2003 and Windows Mobile 5.0 Devices.

    Thanks!
    Michael

    Thank you Michael, I got the Error "Type 'DllImport' is not defined". I changed the Library to "coredll.dll" but still got the Error. May be i missed something
    Sorry, I am a newbie.

     


  • madwinchester

    Michael Koster wrote:

    Hi
    You need do add an Imports statement at the very beginning of the file.

    Add the following line at the very beginning of your .vb file:
    Imports System.Runtime.InteropServices

    Thanks!
    Michael

    Great! It works like a miracle. Thanks again Michael.


  • How to Soft Reset a Device programatically