15,997,462 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by mediamcce (Top 4 by date)
mediamcce
24-Jul-16 12:01pm
View
sendkey.send() function using keyup event not use.
mediamcce
5-Jan-16 5:29am
View
any developer solve this problem
mediamcce
4-Jan-16 22:44pm
View
do not solve this problem
mediamcce
4-Jan-16 21:34pm
View
Deleted
Imports System.Runtime.InteropServices
Public Class Form1
Private Const WH_KEYBOARD_LL As Integer = 13
Private Const WM_KEYUP As Integer = &H101
Private Const WM_SYSKEYUP As Integer = &H105
Private proc As LowLevelKeyboardProcDelegate = AddressOf HookCallback
Private hookID As IntPtr
Private Delegate Function LowLevelKeyboardProcDelegate(ByVal nCode As Integer, ByVal wParam As IntPtr, _
ByVal lParam As IntPtr) As IntPtr
<DllImport("user32")> _
Private Shared Function SetWindowsHookEx(ByVal idHook As Integer, ByVal lpfn As LowLevelKeyboardProcDelegate, _
ByVal hMod As IntPtr, ByVal dwThreadId As UInteger) As IntPtr
End Function
<DllImport("user32.dll")> _
Private Shared Function UnhookWindowsHookEx(ByVal hhk As IntPtr) As <marshalas(unmanagedtype.bool)> Boolean
End Function
<DllImport("user32.dll")> _
Private Shared Function CallNextHookEx(ByVal hhk As IntPtr, ByVal nCode As Integer, ByVal wParam As IntPtr, _
ByVal lParam As IntPtr) As IntPtr
End Function
<DllImport("kernel32.dll", CharSet:=CharSet.Unicode)> _
Private Shared Function GetModuleHandle(ByVal lpModuleName As String) As IntPtr
End Function
Sub New()
InitializeComponent()
Text = "KeyboardPlus 1.01"
hookID = SetHook(proc)
End Sub
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As FormClosingEventArgs) Handles Me.FormClosing
UnhookWindowsHookEx(hookID)
End Sub
Private Function SetHook(ByVal proc As LowLevelKeyboardProcDelegate) As IntPtr
Using curProcess As Process = Process.GetCurrentProcess()
Using curModule As ProcessModule = curProcess.MainModule
Return SetWindowsHookEx(WH_KEYBOARD_LL, proc, GetModuleHandle(curModule.ModuleName), 0)
End Using
End Using
End Function
Private Function HookCallback(ByVal nCode As Integer, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As IntPtr
' "The WM_KEYUP message is posted to the window with the keyboard focus
' when a nonsystem key is released. A nonsystem key is a key that is pressed when the ALT key is not pressed,
' or a keyboard key that is pressed when a window has the keyboard focus."
If nCode >= 0 AndAlso (wParam.ToInt32 = WM_KEYUP OrElse wParam.ToInt32 = WM_SYSKEYUP) Then
Dim vkCode As Integer = Marshal.ReadInt32(lParam)
'vkCode = Keys.B
If vkCode = Keys.A Then
'SendKeys.Send(vbBack)
If Console.CapsLock = True Then
SendKeys.Send("B")
'vkCode = Keys.B
Else
'vkCode = Keys.B
SendKeys.Send("b")
End If
End If
End If
Return CallNextHookEx(hookID, nCode, wParam, lParam)
End Function
End Class
this coding press a but print ab
i have press a print b