|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
insert key stateTrying to get the current status of the insert key. Found
my.computer.keyboard.capslock, but no such item for insert key. Anyone have some code to help. Can't figure out getkeystate. compiler chokes on rslt = getkeystate(keys.insert) ----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups ----= East and West-Coast Server Farms - Total Privacy via Encryption =---- Me,
There are more ways in this which leads to Rome, and even an easier one than I tell you. But just using the keyup event gives you the possibility to set the keyboard statuses in your program. Cor Show quoteHide quote "Me" <gene1***@lisco.com> schreef in bericht news:1158875015_7527@sp6iad.superfeed.net... > > Trying to get the current status of the insert key. Found > my.computer.keyboard.capslock, but no such item for insert key. Anyone > have some code to help. Can't figure out getkeystate. compiler chokes > on > rslt = getkeystate(keys.insert) > > > > > ----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet > News==---- > http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ > Newsgroups > ----= East and West-Coast Server Farms - Total Privacy via Encryption > =---- Try cutting and pasting the following class:
Public Class Keyboard Private Declare Function GetKeyboardState Lib "user32" (ByRef pbKeyState As Byte) As Integer Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwflags As Integer, ByVal dwExtraInfo As Integer) Private Declare Function SendInput Lib "user32.dll" (ByVal nInputs As Integer, ByRef pInputs As GENERALINPUT, ByVal cbSize As Integer) As Integer Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (ByRef pDst As Byte, ByRef pSrc As KEYBDINPUT, ByVal ByteLen As Integer) <StructLayout(LayoutKind.Sequential)> Friend Structure KEYBDINPUT Dim wVK As Short Dim wScan As Short Dim dwFlags As Integer Dim time As Integer Dim dwExtraInfo As Integer End Structure <StructLayout(LayoutKind.Sequential)> Friend Structure GENERALINPUT Dim dwType As Integer Dim wVK As Short Dim wScan As Short Dim dwFlags As Integer Dim time As Integer Dim dwExtraInfo As Integer 'Dim xi() As Byte 'dim 0 to 23 End Structure ' Constant declarations: Const VK_NUMLOCK As Byte = &H90, vk_Scroll As Byte = &H91, vk_Capital As Byte = &H14, vk_Ins As Byte = &H2D, vk_Shift As Byte = &H10 Const KEYEVENTF_EXTENDEDKEY As Byte = &H1, KEYEVENTF_KEYUP As Byte = &H2, INPUT_KEYBOARD As Byte = 1 Private Shared keys(255) As Byte Public Shared Property CapsLockOn() As Boolean Get Return GetKeyState(vk_Capital) End Get Set(ByVal Value As Boolean) SetKeyState(vk_Capital, Value) End Set End Property Public Shared Property NumLockOn() As Boolean Get Return GetKeyState(VK_NUMLOCK) End Get Set(ByVal Value As Boolean) SetKeyState(VK_NUMLOCK, Value) End Set End Property Public Shared Property ScrollLockOn() As Boolean Get Return GetKeyState(vk_Scroll) End Get Set(ByVal Value As Boolean) SetKeyState(vk_Scroll, Value) End Set End Property Public Shared Property InsertModeOn() As Boolean Get Return GetKeyState(vk_Ins) End Get Set(ByVal Value As Boolean) SetKeyState(vk_Ins, Value) End Set End Property Private Shared Function GetKeyState(ByVal keycode As Short) As Boolean GetKeyboardState(keys(0)) Return (keys(keycode) And 1) > 0 End Function Private Shared Sub SetKeyState(ByVal Keycode As Byte, ByVal Value As Boolean) GetKeyboardState(keys(0)) If Value <> ((keys(Keycode) And 1) > 0) Then 'Key Press keybd_event(Keycode, &H45, KEYEVENTF_EXTENDEDKEY Or 0, 0) 'Key Release keybd_event(Keycode, &H45, KEYEVENTF_EXTENDEDKEY Or KEYEVENTF_KEYUP, 0) End If End Sub End Class -- Show quoteHide quoteDennis in Houston "Me" wrote: > > Trying to get the current status of the insert key. Found > my.computer.keyboard.capslock, but no such item for insert key. Anyone > have some code to help. Can't figure out getkeystate. compiler chokes on > rslt = getkeystate(keys.insert) > > > > > ----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==---- > http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups > ----= East and West-Coast Server Farms - Total Privacy via Encryption =---- > Thanks Dennis. Appreciate the good help. Kinda answered some other
questions such as howto also. thanks again...Smitty Show quoteHide quote "Dennis" <Den***@discussions.microsoft.com> wrote in message ----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----news:8634A675-A8E0-4700-99AD-229CE3680E1B@microsoft.com... > Try cutting and pasting the following class: > > Public Class Keyboard > Private Declare Function GetKeyboardState Lib "user32" (ByRef pbKeyState > As > Byte) As Integer > Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal > bScan As Byte, ByVal dwflags As Integer, ByVal dwExtraInfo As Integer) > > Private Declare Function SendInput Lib "user32.dll" (ByVal nInputs As > Integer, ByRef pInputs As GENERALINPUT, ByVal cbSize As Integer) As > Integer > Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (ByRef > pDst As Byte, ByRef pSrc As KEYBDINPUT, ByVal ByteLen As Integer) > <StructLayout(LayoutKind.Sequential)> Friend Structure KEYBDINPUT > Dim wVK As Short > Dim wScan As Short > Dim dwFlags As Integer > Dim time As Integer > Dim dwExtraInfo As Integer > End Structure > <StructLayout(LayoutKind.Sequential)> Friend Structure GENERALINPUT > Dim dwType As Integer > Dim wVK As Short > Dim wScan As Short > Dim dwFlags As Integer > Dim time As Integer > Dim dwExtraInfo As Integer > 'Dim xi() As Byte 'dim 0 to 23 > End Structure > ' Constant declarations: > Const VK_NUMLOCK As Byte = &H90, vk_Scroll As Byte = &H91, vk_Capital As > Byte = &H14, vk_Ins As Byte = &H2D, vk_Shift As Byte = &H10 > Const KEYEVENTF_EXTENDEDKEY As Byte = &H1, KEYEVENTF_KEYUP As Byte = &H2, > INPUT_KEYBOARD As Byte = 1 > Private Shared keys(255) As Byte > > Public Shared Property CapsLockOn() As Boolean > Get > Return GetKeyState(vk_Capital) > End Get > Set(ByVal Value As Boolean) > SetKeyState(vk_Capital, Value) > End Set > End Property > Public Shared Property NumLockOn() As Boolean > Get > Return GetKeyState(VK_NUMLOCK) > End Get > Set(ByVal Value As Boolean) > SetKeyState(VK_NUMLOCK, Value) > End Set > End Property > Public Shared Property ScrollLockOn() As Boolean > Get > Return GetKeyState(vk_Scroll) > End Get > Set(ByVal Value As Boolean) > SetKeyState(vk_Scroll, Value) > End Set > End Property > Public Shared Property InsertModeOn() As Boolean > Get > Return GetKeyState(vk_Ins) > End Get > Set(ByVal Value As Boolean) > SetKeyState(vk_Ins, Value) > End Set > End Property > > Private Shared Function GetKeyState(ByVal keycode As Short) As Boolean > GetKeyboardState(keys(0)) > Return (keys(keycode) And 1) > 0 > End Function > Private Shared Sub SetKeyState(ByVal Keycode As Byte, ByVal Value As > Boolean) > GetKeyboardState(keys(0)) > If Value <> ((keys(Keycode) And 1) > 0) Then > 'Key Press > keybd_event(Keycode, &H45, KEYEVENTF_EXTENDEDKEY Or 0, 0) > 'Key Release > keybd_event(Keycode, &H45, KEYEVENTF_EXTENDEDKEY Or KEYEVENTF_KEYUP, 0) > End If > End Sub > End Class > -- > Dennis in Houston > > > "Me" wrote: > >> >> Trying to get the current status of the insert key. Found >> my.computer.keyboard.capslock, but no such item for insert key. Anyone >> have some code to help. Can't figure out getkeystate. compiler chokes >> on >> rslt = getkeystate(keys.insert) >> >> >> >> >> ----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet >> News==---- >> http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ >> Newsgroups >> ----= East and West-Coast Server Farms - Total Privacy via Encryption >> =---- >> > http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups ----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Report Layout
Which is the better construct? Problem calling a Sub in another form Specifiy that i'm referring to a class, not a member StringReaders and DataWriters and FileStreams, oh, my! Error "Unable to cast object of type"-- but types are the same! PrintDocument and HasMorePages issue Write commands to the COM port TextFieldParser - reading tab delimited file Table in memory |
|||||||||||||||||||||||