PC Review


Reply
Thread Tools Rate Thread

Device buttons

 
 
Jason L James
Guest
Posts: n/a
 
      3rd Sep 2004
Hi all,

does anyone know how to use the device buttons, not
screen buttons in my VB CF .Net code?

Thanks,

Jason.
 
Reply With Quote
 
 
 
 
Jason L James
Guest
Posts: n/a
 
      3rd Sep 2004
Many thanks,

I give it a try.

Jason.

On Fri, 3 Sep 2004 07:35:02 -0700, "=?Utf-8?B?cHJha2FzaA==?="
<(E-Mail Removed)> wrote:

>Hi Jason L James
>Try this code . it is for handling the hardware keys of a PPC Device
>-------------------------------------------
>Imports System
>Imports System.Drawing
>Imports System.Collections
>Imports System.ComponentModel
>Imports System.Windows.Forms
>Imports Microsoft.WindowsCE.Forms
>Imports System.Runtime.InteropServices
>
>Namespace HardwareButtons
>
> Public Enum KeyModifiers As Integer
> None = 0
> Alt = 1
> Control = 2
> Shift = 4
> Windows = 8
> Modkeyup = &H1000
> End Enum
>
> Public Enum KeysHardware As Integer
> Hardware1 = 193
> Hardware2 = 194
> Hardware3 = 195
> Hardware4 = 196
> Hardware5 = 202
>
> End Enum
> Public Module RegisterHKeys
>
> <DllImport("coredll.dll", Entrypoint:="RegisterHotKey",
>setLastError:=True)> _
> Public Function RegisterHotKey( _
> ByVal hWnd As IntPtr, _
> ByVal id As Integer, _
> ByVal Modifiers As HardwareButtons.KeyModifiers, _
> ByVal key As Integer) As Boolean
> End Function
>
> <DllImport("coredll.dll")> _
> Private Function UnregisterFunc1( _
> ByVal modifiers As HardwareButtons.KeyModifiers, _
> ByVal keyID As Integer) As Boolean
> End Function
>
> Public Sub RegisterRecordKey(ByVal hWnd As IntPtr)
> UnregisterFunc1(HardwareButtons.KeyModifiers.Windows,
>CType(HardwareButtons.KeysHardware.Hardware1, Integer))
> RegisterHotKey(hWnd,
>CType(HardwareButtons.KeysHardware.Hardware1, Integer),
>HardwareButtons.KeyModifiers.Windows,
>CType(HardwareButtons.KeysHardware.Hardware1, Integer))
>
> UnregisterFunc1(HardwareButtons.KeyModifiers.Windows,
>CType(HardwareButtons.KeysHardware.Hardware2, Integer))
> RegisterHotKey(hWnd,
>CType(HardwareButtons.KeysHardware.Hardware2, Integer),
>HardwareButtons.KeyModifiers.Windows,
>CType(HardwareButtons.KeysHardware.Hardware2, Integer))
>
> UnregisterFunc1(HardwareButtons.KeyModifiers.Windows,
>CType(HardwareButtons.KeysHardware.Hardware3, Integer))
> RegisterHotKey(hWnd,
>CType(HardwareButtons.KeysHardware.Hardware3, Integer),
>HardwareButtons.KeyModifiers.Windows,
>CType(HardwareButtons.KeysHardware.Hardware3, Integer))
>
> UnregisterFunc1(HardwareButtons.KeyModifiers.Windows,
>CType(HardwareButtons.KeysHardware.Hardware4, Integer))
> RegisterHotKey(hWnd,
>CType(HardwareButtons.KeysHardware.Hardware4, Integer),
>HardwareButtons.KeyModifiers.Windows,
>CType(HardwareButtons.KeysHardware.Hardware4, Integer))
>
> UnregisterFunc1(HardwareButtons.KeyModifiers.Windows,
>CType(HardwareButtons.KeysHardware.Hardware5, Integer))
> RegisterHotKey(hWnd,
>CType(HardwareButtons.KeysHardware.Hardware5, Integer),
>HardwareButtons.KeyModifiers.Windows,
>CType(HardwareButtons.KeysHardware.Hardware5, Integer))
> End Sub
> End Module
> Public Class HButton
> Inherits System.Windows.Forms.Form
> Dim messageWindow As myMessageWindow
>
>#Region " Windows Form Designer generated code "
> Public Shared Sub Main()
> Application.Run(New HButton)
> End Sub
> Public Sub New()
> MyBase.New()
>
> 'This call is required by the Windows Form Designer.
> InitializeComponent()
>
> 'Add any initialization after the InitializeComponent() call
> Me.messageWindow = New myMessageWindow(Me)
> RegisterHKeys.RegisterRecordKey(Me.messageWindow.Hwnd)
> End Sub
>
> Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
> MyBase.Dispose(disposing)
> End Sub
>
> 'NOTE: The following procedure is required by the Windows Form
>Designer
> 'It can be modified using the Windows Form Designer.
> 'Do not modify it using the code editor.
> <System.Diagnostics.DebuggerStepThrough()> Private Sub
>InitializeComponent()
> '
> 'HButton
> '
> Me.Text = "HButton"
>
> End Sub
>
>#End Region
> Public Sub ButtonPressed(ByVal button As Integer)
> Select Case button
> Case HardwareButtons.KeysHardware.Hardware1
> MessageBox.Show("Button 1 pressed!")
> Exit Sub
> Case HardwareButtons.KeysHardware.Hardware2
> MessageBox.Show("Button 2 pressed!")
> Exit Sub
> Case HardwareButtons.KeysHardware.Hardware3
> MessageBox.Show("Button 3 pressed!")
> Exit Sub
> Case HardwareButtons.KeysHardware.Hardware4
> MessageBox.Show("Button 4 pressed!")
> Exit Sub
> Case HardwareButtons.KeysHardware.Hardware5
> MessageBox.Show("Button 5 pressed!")
> Exit Sub
> End Select
> End Sub
> Public Class myMessageWindow
> Inherits messageWindow
>
> Public Const WM_HOTKEY = &H312
> Dim example As HButton
> Public Sub New(ByVal example As HButton)
> Me.example = example
> End Sub
>
> Protected Overrides Sub WndProc(ByRef msg As Message)
> Select Case msg.Msg
> Case WM_HOTKEY
> example.ButtonPressed(msg.WParam.ToInt32())
> Return
> End Select
> MyBase.WndProc(msg)
> End Sub
> End Class
> End Class
>End Namespace
>------------------------------------------------------
>
>
>
>"Jason L James" wrote:
>
>> Hi all,
>>
>> does anyone know how to use the device buttons, not
>> screen buttons in my VB CF .Net code?
>>
>> Thanks,
>>
>> Jason.
>>


 
Reply With Quote
 
Rick Winscot
Guest
Posts: n/a
 
      6th Sep 2004
Jason,

You could also try ButtonHarness.

http://www.pocketgear.com/software_detail.asp?id=12912

It's a single solution for controlling hardware buttons and directional
controls.

Cheers,

Rick Winscot
www.zyche.com


"Jason L James" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi all,
>
> does anyone know how to use the device buttons, not
> screen buttons in my VB CF .Net code?
>
> Thanks,
>
> Jason.



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Buttons becoming Stuck on XPe Device ns Windows XP Embedded 0 4th Jun 2007 07:48 PM
Disable hardware buttons from turning on the device Robert Microsoft Dot NET Compact Framework 1 14th Apr 2006 10:11 AM
Device manager Unknown Device & PCI Device (yellow warning) Alora Duncan Microsoft Windows 2000 Upgrade 1 2nd Feb 2004 05:52 PM
Device manager Unknown Device & PCI Device (yellow warning) Alora Duncan Microsoft Windows 2000 Hardware 1 2nd Feb 2004 05:52 PM
Re: Directional buttons on Pocket PC device Richard Kucia Microsoft Dot NET Compact Framework 1 11th Aug 2003 06:21 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:08 AM.