|
-
Jun 3rd, 2009, 10:15 PM
#1
Thread Starter
Junior Member
[RESOLVED] Disable Mobile Hardware Buttons
Hi! I'm setting up a WM6 phone for Kiosk style. I got the max screen and so on but I can't seem to find any option in VS2008 to let me disable the HW buttons. I did find the website http://www.codeproject.com/KB/smart/CF_kiosk_mode.aspx
But its in C. I tried converting it to VB, but I get numerous errors.
For one
C:
public const int WM_HOTKEY = 0x0312;
VB:
Public Const WM_HOTKEY As Integer = 0x0312
I get an "End of Statement Expected"
I'm still pretty new at programming so if anyone can help me out I would appreciate it. Below is what I converted based off of the code you can download.
Code:
Imports System.Diagnostics
Imports System.Runtime.InteropServices
Imports Microsoft.Win32
Imports System.IO
Imports Microsoft.WindowsCE.Forms
Imports System.Windows.Forms
Public Class InternalMessageWindow
Inherits MessageWindow
Public Const WM_HOTKEY As Integer = 0x0312
Dim i As New InternalMessageWindow()
Dim referedForm As New Form
Public Sub internalMessageWindow(ByVal referedForm)
i.referedForm = referedForm
End Sub
Protected Overrides Sub WndProc(ByRef msg As Message)
Select Case msg.Msg
Case WM_HOTKEY
'Do no reply to this key ...
End Select
MyBase.WndProc(msg)
End Sub
End Class
Public Enum KeyModifiers
None = 0
Alt = 1
Control = 2
Shift = 4
Windows = 8
Modkeyup = 0x1000
End Enum
Public Enum KeysHardware As Integer
Hardware1 = 193
Hardware2 = 194
Hardware3 = 195
Hardware4 = 196
End Enum
Public Class FormWithMessage
Inherits Form
Dim i As New FormWithMessage()
Dim messagewindow As New InternalMessageWindow
Public Sub FormWithMessage()
i.messagewindow = New InternalMessageWindow(i)
RegisterHKeys.RegisterRecordKey(i.messageWindow.Hwnd)
End Sub
End Class
Public Class RegisterHKeys
Dim modifiers As New KeyModifiers
<DllImport("coredll.dll")> _
Public Shared Sub RegisterHotKey(ByVal hWnd As IntPtr, ByVal id As Integer, ByVal Modifiers, ByVal key As Integer)
' handle to window
' hot key identifier
' key-modifier options
' virtual-key code
End Sub
<DllImport("coredll.dll")> _
Private Shared Sub UnregisterFunc1(ByVal modifiers, ByVal keyID As Integer)
End Sub
Public Sub RegisterRecordKey(ByVal hWnd As IntPtr)
UnregisterFunc1(KeyModifiers.Windows, KeysHardware.Hardware1)
RegisterHotKey(hWnd, KeysHardware.Hardware1, KeyModifiers.Windows, KeysHardware.Hardware1)
UnregisterFunc1(KeyModifiers.Windows, KeysHardware.Hardware2)
RegisterHotKey(hWnd, KeysHardware.Hardware2, KeyModifiers.Windows, KeysHardware.Hardware2)
UnregisterFunc1(KeyModifiers.Windows, (KeysHardware.Hardware3)
RegisterHotKey(hWnd, KeysHardware.Hardware3, KeyModifiers.Windows, KeysHardware.Hardware3)
UnregisterFunc1(KeyModifiers.Windows, KeysHardware.Hardware4)
RegisterHotKey(hWnd, KeysHardware.Hardware4, KeyModifiers.Windows, KeysHardware.Hardware4)
End Sub
End Class
-
Jun 4th, 2009, 02:19 AM
#2
Frenzied Member
Re: Disable Mobile Hardware Buttons
Hi,
the code you got was from before there was hardware button support out of the box.
Stick a 'hardwarebutton' on your form from the toolbox, and handle the events in your main form.
-
Jun 4th, 2009, 04:03 PM
#3
Thread Starter
Junior Member
Re: Disable Mobile Hardware Buttons
I see what your saying! Thanks!
I also found a good video about it if anyone else is interested.
http://msdn.microsoft.com/en-us/netf.../cc721665.aspx
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
|