Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Keystroke Code


Could anyone please tell me how to achieve the following?

If the user presses "A" on his keyboard:

1) Text(0) will have A written in it.
2) Check(0) will be checked.

I couldn't find a simple API to use, if I need one at all.

Thanks,
Dub




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Keystroke
I'm trying to catch an keystroke on the child form, which is the enter button is not trapped when pressed. any information will help.

*** Keystroke HELP ***
Basically I just want to use three different timers for to act as if they are pressing these keys every so often

( ) = Ascii Code

1. Shift (16) + End (35)
2. Home (36)
3. Shift (16) + Home (36)

It should be a simple code I believe, just wanting the best script to put into those timers to stroke those keys every so interval i choose.

Keystroke Recognition
next week in visual basic class, we are going to start working on simple games, like pong or something.. the prof hasnt decided yet, because this isnt part of the sylibus, we actually finished it very early so we are jsut doing fun stuff now...

but he is mainly a c++ programmer and doesnt know the exact syntax to define keystrokes..

like if i hit the right arrow key, i want the paddle, or charecter to move right...

i am assuming i turn the keystroke to a variable where i take the keystroke and declare it as X and have it change the position of the charecter

but yea.. he doesnt know the syntax to it.. and i really want to start learning this

Keystroke Outside Form
I'm trying to make a program to simulate keystrokes outside a form. I've tried using the keybd_event API to no avail. I think the problem is the focus of the keystrokes is on the program and not where i want it. I even tried to set the form.visible = false, but i still wasn't receiving the keystrokes I need.

any help would be appreciated

PrintScreen Keystroke
I have some code that uses a timer to check whether the F12 key is pressed then performs a print screen. The print screen works fine and so does most of the code, the only problem is that sometimes the print screen doesn't fire, so I replaced that code with a msgbox. The code still doesnt fire sometimes, no matter what interval the timer is set to. Is there another way other than using a timer to do this?

Here is the code:


Code:
Private Sub Timer1_Timer()
Dim KeyResult As Long
' checks every 1 millisecond to see if the user has pressed one of the following keys then sends the cheat codes
KeyResult = GetAsyncKeyState(123) 'if keyresult is '123'(F12) then printscreen
If KeyResult = -32767 Then
MsgBox ("PrintScreen")
End If
End Sub

Simulate Keystroke
How can i simulate a keystroke in active window

(is there some other way then using sendkeys that kind of doesnt work for me)

Emulate Keystroke
is there a way to emulate a keystroke in a dos window

Emulate A Keystroke
How can I emulate a key stroke in a bat file?

Keystroke Logging
Hey everyone,

I need to be able to log keystrokes for a security program I am working on.
i.e. record the keys being pressed even when my program isnít in focus.

Does anybody know if there is away of doing this from visual basic or do I need to use C++???

thanx
N...

Keystroke Logging
I would like to how ,if it is possible, to capture keyevents when the vb prog is not the prog with focus.

Detecting A Keystroke
Is there a way I can sendkeys to another program when the user presses Ctrl+V? The current form would be inactive and it would need to detect the key stroke. All help is greatly appreciated.

Aquaflight

Track Every Keystroke
Dear All,

I want to create a program that run a function/sub when a key is pressed with its code. Even my programe is not active or minimize.
Can anybody help me to do this.

Keystroke Simulation
I need to simulate keystrokes for a program that clicks each message that pops up on my home computer. One of the messages is a simple message box, with a simple OK thing, saying that my Anti-spyware isn't working, and if I want to access online help. All of the others are pretty much the same, and have the same irrelevance in my program.

What it needs to do is:
Run on start up (know)
Press enter four times on each message box
Close after enter has been pressed each time (know)

but whenever I use this API call...

Code:
keybd_event vbkeyReturn, 0, 0, 0 'press key
keybd_event vbkeyReturn, 0, KEYEVENTF_KEYUP, 0 ' release key
it sends the keystroke to the form itself...i think
How can I change the call, or set something else, to ensure that the message is 'clicked' each time
I also need to know how to detect when the message pops up, but I could just press enter for about ten seconds, but it would be nice to have it event driven, or a cheap equvalent of that.

Anyone?

Edit:
I just tried this code

Code:
SendMessage hWindow, WM_CHAR, VK_A, 0&
and it didn't work

Keystroke Problem?
Code:
Dim Stopall As Boolean
Private Declare Function GetAsyncKeyState Lib "User32" _
(ByVal vKey As KeyCodeConstants) As Long
Private Function KeyDown(ByVal vKey As KeyCodeConstants) _
As Boolean
KeyDown = GetAsyncKeyState(vKey) And &H8000
End Function

Private Sub Form_Load()
Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()

If KeyDown(vbKey0) Then
Keystrokes.Text = Keystrokes.Text & "0"
End If
If KeyDown(vbKeyS) Then
Keystrokes.Text = Keystrokes.Text & "s"
End If
End Sub
When I use this code, my Keystrokes.Text string returns multiple "s"s and "0"s.

How can I have it return only one??

Does VB Have Keystroke Comand That?
Is there any Function that stops and gets a keystroke, like suspend key in
Dark Basic or waitkey in Blitz Basic?

Decimal Keystroke
The code mentioned below allows only numbers to enter, but I want decimal as well. How can I enable the decimal keystroke?

----------------------------------------------------------------------------------

Private Sub txtboxname_KeyPress(KeyAscii As Integer)

Dim Numbers As Integer
Numbers = KeyAscii
If ((Numbers < 48 Or Numbers > 57) And Numbers <> 8) Then
Beep
KeyAscii = 0
End If

End Sub


-----------------------------------------------------------------------------------

Keystroke For A Checkbox?
I am curous and I have been working on figuring this out, but want to know if it is first possible:

I was looking to allowing the user to use a keystroke or the Enter carriage to intiate a checkbox instead of using the mouse??

I am trying to make my interface a little better ( I got a long way to go)

Thank you.

Keystroke Copier
Does anyone out there know of some good packages which record your cursor and keystroke movements? i am looking to create a training manual but i wouold like to do it so that the user can see visually the steps to take i.e. as if i were sat there moving the mouse, etc.

Listbox + Keystroke ****
for some reason this event doesn't fire on a delete keystrike. I want that when i press delete on the listbox certain events happen. This code however doesn't evenget fired when I press delete on the listbox.

Private Sub lstOverview_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = vbKeyDelete Then
mdeConnection.cmd = "DELETE * FROM tbl_header WHERE IDCode=" & txtfrmAdd(0).Text & " AND Keyword ='" & lstKeywords.List(lstKeywords.ListIndex) & "'"
mdeConnection.connector

lstKeywords.RemoveItem (lstKeywords.ListIndex)
End If
End Sub

Ignore Keystroke
trying to use KeyAscii to ignore the KeyDown keystroke event. Want it to have no effect if user hits the arrow down button. Control in KeyAscii to virtually ignore that particular keystroke.

any KeyAscii experts out there?

What Is Your Favorite Keystroke In VB?
Mine is Ctl + Space
and then Shift + F2

Whats yours?

Help On A Keystroke Simulator
Im not making a virus ro anything, but I would like some help with an application that can "type" for me in another window.

I have a database with some fields. These fields need to be typed in a window with some different fields.

The thing is im just too lazy hehehe. No just kidding its something like 2000 entries i have to copy

Keystroke Question
Hi guys, i am coding an application for touchscreen units and have make a keyboard for onscreen data entry. Trouble is i can't figure out how to tell which keys are pressed on the keyboard. I use a temp variable to store keys pressed on my screen keyboard but i also need to add strokes from an actual keyboard if the user decides to use both. I am sure there is a list of keyboard codes but i can't find them. Thanks for the help!!

Automate Dos Keystroke
This is the portion of code i wrote. but things that appeared is several characters

Why and how to fix it

--------------------------------------------------------
cmdline$ = "C:WINDOWSCOMMAND.COM"

ProcessId& = Shell(cmdline$, 1)

AppActivate ProcessId&

SendKeys "dir~", true

How I Detect The Tab Keystroke
Hi team.

I need to know if the LostFocus event was caused by the tab key, as opposed to some other event, as i want to respond differently to the tab.
The trouble is I can't pick up the tab keystroke with the Keydown event. The LostFocus event fires instead. Does anyone know how to get around this?

How Can I Get The Keystroke On A Form
How can i get the keystorke (when a key is pressed) on the form when there are lots of controls on the form. I can get the keystroke when the form is empty but not when I have some controls on it.

can you give me the code/

Search DB By Keystroke
I am trying to search a ComboBox by each letter I type in. When there is a match, I want the result to come up. It's kind of like when you type a character a new list comes up. I'm really not sure what kind of search this is called. Here is my SQL statement:

sqlStr = "SELECT * FROM Items WHERE desc LIKE '" & tmpStr & "%'"

Anyone know what I'm trying to do?

Thanks for your help!

Jeff

Keystroke Listen
DO U KNOW HOW CAN I LISTEN AND PUT ON A TEXT BOX, ALL THE KEY THAT THE USER CLICK ON HIS KEYBOARD, NOT HAVING THE FOCUS OF THE PROJECT AND WITHOUT USING TIMER OBJECT?

IT'S POSSIBLE TO GET "SPECIAL" KEYS LIKE CURSORS,ENTER,CANCEL,"?","&","~","į","|",ecc. ecc.?

IF POSSIBLE TO HAVE A SAMPLE PROJECT...BUT I NEED ONLY IF IT DOESN'T USE EXTERNAL DLL OR OBJECT ONLY THE WINDOWS'S API BECAUSE I DON'T WANT TO DO AN INSTALLATION WIZARD WITH EXTERNAL FILES!!!

HELP ME

MANY MANY THANKS

Unassign A Keystroke And Set It To Nothing
Is there an api or code to disable the ctrl+S save key. I need it to perform a calculation in my Excel project instead thanks

Virtual Keystroke, Take 2
I need to be able send an emulated keystroke to another windows application, that does not have the focus. My VB program is going to receive commands via the serial port, process the commands, then send an appropriate emulated "keystroke" to another windows application.

How do I create an emulated keystroke and send it to the other windows program?

Thanks,

Eric

Capturing &#039;F1&#039; Keystroke
There a way to capture an F1 keystroke? It doesn't have an ascii code...

Keystroke Trapping
I would like to know if there's a way of making a form trap a certain
keystroke no matter what control on the form has focus.

I have KeyDown and KeyPress procedures for various controls on the form for
various reasons. But I would like to trap the PageUp and PageDown keys in
the form itself, if possible, without having to write code in the relevant
event procedure for every control on the form... There are a lot of
controls.

Any ideas... I know how to do it the long way... I was hoping there might be
an easier one?

Thanks,
Mark.

Keystroke Log Reader
Hi All,

I am using some code I found which records keystrokes to a log file.

What I would like to do now is format the log file to make it readable.

An output example would be:

"I needd[BKSPACE] too[LEFT][DEL] format the[BKSPACE]is"

Coded keystrokes are [UP][DOWN][LEFT][RIGHT][DEL][BKSPACE][ENTER]

The only way I can think of doing this is to read it in chr by chr, performing the keystrokes as it's read.

Any help would be great.

Cheers,
D

Need Keystroke Comand
Is there any Function that stops and gets a keystroke, like suspend key in
Dark Basic or waitkey in Blitz Basic?

 

How To Detect Keystroke In VB
Hi,

I wanted to build a function where user can press the shortcut CTRL+S to save all the modification that they have done. The function must be available in all the forms of the VB application. So, we don't care which form is the user currently in, once they type CTRL+S, all their works must be saved automatically.

Could anybody give me a solution for this?


Thanks,
Jenty

Keystroke Events
How can I disable the menu key, alt tab key combination, and the ctrl+alt+del combo? HELP!

Keystroke Tracking - Please Help!
Hi,
I have some Visual Basic experience but I need some help from the VB experts. Here is what I am trying to accomplish:

- The program will start when Windows starts
- The program will be hidden
- All keystrokes that the user makes will be logged into a text file

That seems fairly simple, but I'm not sure of how to make the program start with windows, nor am I sure of how to get each key.
Thanks to all of you! Replies are much appreciated.

Keystroke Rate Problems
Whilst creating my first platformer, I met a problem.

I have been using key press, and saying somethign like

If KeyAscii = "97" Then
Man.Left = Man.Left - 160
If Man.Left <= 0 Then Man.Left = 0
End If

However, the keystroke rate means that the character moves to the left 160 pix, stops for a moment, and then jerks across at even intervals. How can I prevent this, (without changing the keystroke rate.) your help is apreciated.

'Enter' Keystroke Events
just a little food for thought, is there a way to make a text box recognize when the 'enter' key has been hit? I have a logg on form and you can either click the button with the mouse, or if your in the password text box you can hit enter twice (once to move from the box to the button, once to click the button). does anyone know how to set it up so when you hit enter it just 'clicks' the button?

anyone have any input on this?

Braden

VBA Implementation Of API Keystroke Listener
I would like to incorporate a "universal" keystroke event into my VBA forms-based project. I would like to associate the "Escape" key event with setting a form's MousePointer to default mode.

The forms in my project contain several multipages with dozens of controls, so assigning a KeyPress or KeyDown event to each object seems excessive. I suspect there is a simpler and more reliable API procedure.

Thanks in advance.

HOw Can I Send A Keystroke To Notepad
Just an easy one question.
I have something like this:

Dim ProcID As Integer
ProcID = Shell("notepad.exe", 1)
AppActivate (ProcID)
SendKeys "hello World"

but it's not working..do I need any reference or sth?


Thanks in advance

Send Keystroke Using PostMessage?
I am having trouble using the postMessage to send the keystroke "m" to a window of another application.

I can use sendKeys but I'd like to not have to bring the app into focus until I am done.

Here is what I have compiled so far:


Code:
Declare Function PostMessage Lib "user32" Alias "PostMessageA" ( _
ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long _
) As Long

Const WM_KEYUP = &H101
Const WM_KEYDOWN = &H100
Call PostMessage(hwnd, WM_KEYDOWN, vbKeyM, ByVal 0&)
Call PostMessage(hwnd, WM_KEYUP, vbKeyM, ByVal 0&)

I had found most of this code in some searches, does this look right because it doesn't work.

Thanks in advance----

Register Keystroke During Loop
I go some help from here yesterday. Im part way there but still don't seem to be able to get the code to work:

I am trying to create a loop for displaying:

(Cross)
(Blank Screen)
(Word from a Randomised List)

Then wait for a keypress (either N or W) before beging the next loop.

I am using a time stamp DLL and direct draw 7. However the basic problem is that the loop just repeats without detecting any keypress.

DECLARATIONS - GENERAL - MODULE

Declare Function GetAsyncKeystate Lib "user32.dll" (ByVal vkey As Integer) As Integer


CODE IN FORM

Do Until GetAsyncKeystate(vbreturn)
DoEvents
blititWord
Loop

I get a nasty warning message about "cant find GetAsyncKeystate entry point in user32.dll"

Need Function That Stops && Gets Keystroke
Is there any Function that stops and gets a keystroke, like suspend key in
Dark Basic or waitkey in Blitz Basic?

Undoing One Single Keystroke Only???
Please see my below problem and see if you can help me

How Do I Send A Keystroke Sequence Within VB?
I am trying to send a key stroke sequence from within my VB program.

Does anyone know how to send "ctrl-end" (using sendkeys or something)?

I also would like to know how to send a number of "down" arrow strokes.

Thank you.

Weird Keystroke Question
Instead of :

Private Sub BallArea_KeyUp(KeyCode As Integer, Shift As Integer)

If KeyCode = vbKeyQ Then
RedUp = 0
End If

I would like to store the vbKeyQ into a variable to help me manipulate it a little. However the below doesnt seem to work.



Private Sub Form_Load()

RedUpKey = "VBKeyQ"

.....................................
Private Sub BallArea_KeyUp(KeyCode As Integer, Shift As Integer)

If KeyCode = RedUpKey Then
RedUp = 0
End If

.....................................

Ideally i would like to get this workng below here, but above would still be cool.


Private Sub Form_Load()

RedUpKey = "Q"

.....................................
Private Sub BallArea_KeyUp(KeyCode As Integer, Shift As Integer)

If KeyCode = str("vbKey" + RedUpKey) Then
RedUp = 0
End If

.....................................


Cheers.

Keystroke Detection From A Different Event
I am dealing with VideoSoft Flex Grid control. It has an event "LeaveCell", which gets fired when the cursor leaves a cell. This event doesn't get an arguments/parameters.

I need to put some code in this LeaveCell event to detect which key was pressed to leave the cell. Need to add different behaviors for Enter and Tab keys.

KeyUp or KeyDown events don't work consistently.

Will appreciate any help.

Keystroke / Keyboard Emulation ?
Hi,

I want to create a form that is act as mini keyboard, let say with 4 buttons "A" "B" "C" "D" when clicking on those button, it will act as press the keyboard letter A, B,C or D and put the value on to the input field that is focusing on the screen.

But that input field is on a browser web form, not on the application itself, so it like virtual keyboard.

Is that possible for VB6? if yes how to do that?

Thanks

Copyright © 2005-08 www.BigResource.com, All rights reserved