Key press?
Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
how can you make it tell if shift/alt/control is pushed?
like as in {SHIFT} A for cap.?
like as in {SHIFT} A for cap.?
If you don't need that as a key combination, why not to use
SendKeys.Send("A")
EDIT: I am not sure, but you could give a try for SendKeys.Send("{SHIFT}"+"{A}")
EDIT: @Mandai, my bad...
SendKeys.Send("A")
EDIT: I am not sure, but you could give a try for SendKeys.Send("{SHIFT}"+"{A}")
EDIT: @Mandai, my bad...
Last edited by bisnes_niko on Tue Mar 01, 2011 12:30 pm, edited 1 time in total.
I don't think we are trying to send keys.
You can tell if keys are being held with GetAsyncKeyState.
You can tell if keys are being held with GetAsyncKeyState.
Code: Select all
<DllImport("user32.dll")> Shared Function GetAsyncKeyState(ByVal vKey As Integer) As Short
End Function
Private Sub btnCheck_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCheck.Click
Dim res As Short = GetAsyncKeyState(Keys.LShiftKey)
If res = -32767 Then
MsgBox("Left shift is down")
End If
End Sub
Now i have a key hook that i am building, but i need to get it to work with the SHIFT so i can get upper case A's instead of only lower case.
You can use GetAsyncKeyState to look for shift keys, if it is down/up you could change a caps state in the program.
I think it's like
Code: Select all
If e.Shift = True And e.keycode = keys.A Then
I have having the issue with getting the shift key and all other keys besides the main letter keys...

so its built to read keys
Code: Select all
theres my main class, the key hook i have got from online Imports System.Runtime.InteropServices
Public Class Form1
Private WithEvents keyboard As New KeyboardHook
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Dim shift As Boolean
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
RichTextBox1.Text = TextBox1.Text
End Sub
Private Sub keyboard_KeyDown(ByVal Key As System.Windows.Forms.Keys) Handles keyboard.KeyDown
If Key = Keys.Space Then
TextBox1.AppendText(" ")
End If
If Key = Keys.Enter Then
TextBox1.AppendText(vbNewLine)
End If
End Sub
End Class

code it wrote:I think it's likethis would be if its for like a component in the program, i am using a key hook..Code: Select allIf e.Shift = True And e.keycode = keys.A Then
so its built to read keys

I tried this code a while ago in my browser and had to remove it later cuz it didn't work. SO if you find out, please tell me so.
Copyright Information
Copyright © Codenstuff.com 2020 - 2023