|
-
Mar 9th, 2006, 11:51 AM
#1
Thread Starter
New Member
Restart windows from vb.net
Hi,
I need to restart windows CE from within my application. Does anyone know how to do this? Im using vb.net compact.
Thanks,
Tim
-
Mar 10th, 2006, 04:24 AM
#2
Fanatic Member
Re: Restart windows from vb.net
This class will do it
VB Code:
Imports System.Runtime.InteropServices
Public Class DeviceReboot
<DllImport("coredll")> _
Private Shared Function SetSystemPowerState( _
ByVal psState As String, _
ByVal StateFlags As Integer, _
ByVal Options As Integer) As Integer
End Function
Const POWER_STATE_ON As Integer = &H10000
Const POWER_STATE_OFF As Integer = &H20000
Const POWER_STATE_SUSPEND As Integer = &H200000
Const POWER_STATE_RESET As Integer = &H800000
Public Sub New()
End Sub
Public Function Reboot()
Try
SetSystemPowerState(Nothing, POWER_STATE_RESET, 0)
Catch ex As Exception
Throw New Exception(ex.Message)
End Try
End Function
End Class
Barry
Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
.NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0
SQL Server 2005/2000/SQL Server CE 2.0
If you like, rate this post
Compact Framework for Beginners
-
Mar 10th, 2006, 05:48 AM
#3
Thread Starter
New Member
Re: Restart windows from vb.net
-
Mar 10th, 2006, 05:52 AM
#4
Fanatic Member
Re: Restart windows from vb.net
just a as a point to note.....
the reboot worked fine for me on the devices we use Psion Workabout Pro,
but i've also tried it on the PSC Falcon and the reboot option didnt work.
i have other code to make this work if you are using PSC and the class posted above doesnt work
Barry
Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
.NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0
SQL Server 2005/2000/SQL Server CE 2.0
If you like, rate this post
Compact Framework for Beginners
-
Mar 10th, 2006, 05:54 AM
#5
Thread Starter
New Member
Re: Restart windows from vb.net
cheers. Worked fine on my device.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|