Soft Reset and Power Off

  • Thread starter Thread starter Mark Davison
  • Start date Start date
M

Mark Davison

Hi,

Cananyone point me in the right direction for writing code (vb.net) to do a
soft reset and to turn the device off?

Regards,

Mark
 
Mark,

Thanks for the information, the Soft Reset works perfectly!

I am having troublke with the power off. I think I have cobbled it together
from the samples I found in different languages. My declare is now:

<DllImport("user32")> _
Public Sub keybd_event( _
ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Integer, ByVal
dwExtraInfo As Integer _
)
End Sub

which I call using:

Const VK_OFF As Byte = &HDF
Call keybd_event(VK_OFF, &H0, 0, 0)

This results in a MissingMethodException and I cannot see where I have gone
wrong.

Regards,

Mark
 
On Windows CE keyb_event is in coredll.dll Also your P/Invoke should be
marked as Shared (although if you place it in a VB Module it will be assumed
to be shared) e.g.:-

<DllImport("coredll")> _
Public Shared Sub keybd_event(ByVal bVk As Byte, ByVal bScan As Byte, ByVal
dwFlags As Integer, ByVal dwExtraInfo As Integer)
End Sub

Peter
 
Thanks Peter!!! That worked great!!

Mark

Peter Foot said:
On Windows CE keyb_event is in coredll.dll Also your P/Invoke should be
marked as Shared (although if you place it in a VB Module it will be
assumed to be shared) e.g.:-

<DllImport("coredll")> _
Public Shared Sub keybd_event(ByVal bVk As Byte, ByVal bScan As Byte,
ByVal dwFlags As Integer, ByVal dwExtraInfo As Integer)
End Sub

Peter

--
Peter Foot
Windows Embedded MVP
http://www.inthehand.com | http://www.peterfoot.net |
http://www.opennetcf.org
 
Back
Top