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




SendMessage To Send Keystrokes


NvmI am using the keybd_event instead now.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
SendMessage To Send Keystrokes
Can SendMessage be used to send keystrokes?

I'd like to send the keys ctrl+eaa [ctrl is held down while eaa is pressed]. Anyone know to do this?

Thanx

Sending Keystrokes With SendMessage
Hi:

How can I send a keystroke (ex: letter "b") to a specified window ?? I have heard that it can be done with the SendMessage or PostMessage function but I cant get it to work.

¿ Can anyone give me an example ?

I have tried a lot of codes but none of them work. Please Help.
Thank you very much

Send Keystrokes
How do I send keystrokes to another application from a vb application?

Send Keystrokes
This is just like what GameCommander does. It sends keystrokes to an application, for example, t H e l l o enter. This sends a chat message in NASCAR 2002. It hooks on to the process. I am wondering, what is the API call to send key commands? I know how to hook into a window ETC, just need to know how to send the commands.

Thanks,
AnT

How Can I Send Keystrokes To Another App?
hi,
I need to create a small application that will act as a keyboard on screen. How can I send simulate keystrokes in another application?

Thanks,
Cedric

Can I Send Keystrokes To A Minimised App?
Hi.
I have written an app to control a camera. I have hooked up a button to the com port and use an on comm event to trigger the shutter. Ideally I would like to use a keyboard key (such as F1) to trigger the shutter (or do command1_click) but I want this to happen while the app is minimised and another app (not mine, no source code) is running and being used. Is this possible or can keystrokes only be sent to the focused app?

Thanks

Send Keystrokes To Another Program
How do I send keystrokes to a running program?

Send Keystrokes To Dos Program
I have a dos program that I want to have VB work with. What I need is it to start the program. The program will ask for some info that I need VB to send then enter must be hit. Then I need for it to do it again and have enter hit again. I want it so that its all automated so I dont have to be physically touching any keys. Is this possible?? If so what commands should I look to learning?

THanks in advance

Can I Send Keystrokes To A DirectX Game?
I want to send keystrokes or mouse clicks to a directX game, basically for an auto-fire type thing.

Is there any way to do this?

thanks,

brandon

How To Send Keystrokes To A Child Of A Form?
how do i send keystrokes to a child of a form?

the prgram that im trying to keystrokes to contains a textbox where i ud input my command... i tried using this code:
===================
appactivate "progname"
sendkeys ("command")
sendkeys ("~")
appactivate "progname"
==================
i believe that this code only works on parent forms so meaning i cant send keystrokes to my programs child textbox...

so what do i have to do to send keystrokes to a child of my form? ^_^ thnx

Send Keystrokes To Another Programs Login Dialog Box
How can I send login keystrokes from VB to another windows program's login dialog box??

How Can I Achieve Communication Between Two Applications Send Keystrokes
I want to send keystrokes with command_onclick event . When I push buttons on my vbform I must send this keystroke to another window's text box like Windows2000's On-Screen Keyboard Program does. But when I activate my form to push button target window lost focus. I tried to get handle target window then activate it but i couldnt do it. Can anybody help me about this. If anybody can send me a code snippet that can send keystrokes with a command button to another open window's text box I will be glad thank you.

Send Keystrokes And Click Buttons In Another Application Window?
Hello - I'm using VB6.

Is it possible to click the 'OK' button in another applications window from my application.

Is it also possible to send keystrokes to another applications window as well??

I as trying to write a program to facilitate the installation of numerous software packages in one go - But each install package always ends with a message box 'click ok to finish' (or similar)

If I could get my software to wait for the window then simulate an mouse click - it would make it much better than the user having to keep watch over the machine and click all the ok buttons to continue.

The requirement to send keystrokes is also for the same thing but not quite as important as it happens a lot less frequently - ie other installer askes for the location to install to for example.

Thanks

Icarusbop

How To Send LVM_SETTEXTCOLOR By SendMessage?
Hi all . could any one show me how i can send LVM_SETTEXTCOLOR by using SendMessage? I just do not know how use LVM_SETTEXTCOLOR !!Thanks

How To Send Backspace Key Using Sendmessage
Hi,

Is there a way to send the backspace key to the active window using sendmessage .

here is what i'm using ...


VB Code:
Call SendMessage(ds2, WM_KEYDOWN, &H8, 0)    Call SendMessage(ds2, WM_KEYUP, &H8, 1)    Call PostMessage(ds2, WM_CHAR, &H8, 1)    Call PostMessage(ds2, WM_CHAR, Asc(chr_a), 1)


Some programs don't get the WM_CHAR when used with backspace so I send the WM_KEYDOWN with it ...

but does not work with all the programs ....

SendKeys, SendMessage, Send Me...
Hi Guys,

As always I've tried and died on this one so many times...

( START ESSAY )

I'm trying to send keys to a WebBrowser control within my program that is connected to an external website.
I can get the start of the procedure to work (shakily, but working.) However it seems to not want to carry on after I reach a certain point.
Basically, the page in question is a Submission page for hotel guest info, and I want to automatically send the file required. Here's the annotated code:

CODEPrivate Sub Command1_Click()
    Dim x As Integer
    
    'Open Logon page of Website
    WebBrowser1.Navigate sHotelLogOnPage
    'Wait for Browser
    Do While WebBrowser1.Busy = True
        DoEvents
    Loop
  
    WebBrowser1.SetFocus
    'Wait for Browser
    Do While WebBrowser1.Busy = True
        DoEvents
    Loop
    'Send ENTER Key to Enter Site
    SendKeys "{ENTER}", True
    WebBrowser1.SetFocus
    
    'Wait for Browser
    Do While WebBrowser1.Busy = True
        DoEvents
    Loop
    WebBrowser1.SetFocus
    
    'Send TAB to Activate Page,
    'SHIFT+TAB to back up to Logon Box
    'USERNAME of User
    'TAB to Password Box
    'PASSWORD of User

    SendKeys "{TAB}"
    SendKeys "+{TAB}"
    SendKeys sHotelUserName
    SendKeys "{TAB}"
    SendKeys sHotelPassword
    
    'Send Three Tabs to Reach SUBMIT Button
    For x = 1 To 3
        SendKeys "{TAB}", True
    Next x
    'SPACE Key to Activate Submit Button
    SendKeys " ", True

    'Wait for Browser
    Do While WebBrowser1.Busy = True
        DoEvents
    Loop
    
    'OPEN Send Page for File Entry
    WebBrowser1.Navigate sHotelSendPage

    'Wait for Browser
    Do While WebBrowser1.Busy = True
        DoEvents
    Loop
    WebBrowser1.SetFocus

    'Wait for Browser
    Do While WebBrowser1.Busy = True
        DoEvents
    Loop

    'Send SEVEN Tabs to Reach Filename textbox
    For x = 1 To 7
        SendKeys "{TAB}", True
    Next x

    'Send Filename
    SendKeys sGuestFileName

    'Send THREE Tabs to Reach SUBMIT Button
    For x = 1 To 3
        SendKeys "{TAB}", True
    Next x
    
    'Send SPACE to activate submit button.
    SendKeys " "
    
       
End Sub


How Correctly Use SendMessage To Send Combination Keys
Good evening,
my question is about the correct use of SendMessage in conjuction with WM_KEYDOWN and WM_KEYUP as it was SendKeys.

I get via Spy++ the sequence of messages that an external applicatione receives when the user press "ALT+F" (they are attached).

To repeat the same sequence I wrote this code, but doesn't work.

Call SendMessage(hFound, WM_SYSKEYDOWN, &H12, 0&)
Call SendMessage(hFound, WM_SYSKEYDOWN, &H66, 0&) 'F
Call SendMessage(hFound, WM_SYSCHAR, &H66, 0&) 'f
Call SendMessage(hFound, WM_SYSCHAR, &H66, 0&) 'f

Call SendMessage(hFound, WM_SYSCOMMAND, SC_KEYMENU, 0&)
Call SendMessage(hFound, WM_SYSKEYUP, 70&, 0&) 'F
Call SendMessage(hFound, WM_SYSKEYUP, &H12, 0&)

Call SendMessage(hFound, WM_KEYDOWN, 97&, 0&) 'A
Call SendMessage(hFound, WM_KEYUP, 97&, 0&) 'A
Call SendMessage(hFound, WM_CHAR, 97&, 0&) 'a

Can you help me? Thank you so much.
Emilio.

(VB6) How Can I Use Sendmessage To Send Text To A Program Outside Visual Basic?
...for instance to Notepad or mIRC?

I read the FAQ about getting the handles, but I don't know how to send some text.

Anyone?

How Can I Send An "CTRL" -i Command Using PostMessage (or SendMessage) ?
Hello
Sending normal chars works fine, but how can i send an "CTRL" -i command
using PostMessage (or SendMessage) ?


Sample:






Private 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
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Const WM_KEYDOWN = &H100
Private Const WM_KEYUP = &H101
Private Const WM_CHAR = &H102
Private Const WM_SYSKEYDOWN = &H104
Private Const WM_SYSKEYUP = &H105
Private Const VK_SHIFT = &H10
Private Const VK_CONTROL = &H11
Dim hWn


Private Sub Form_Load()
Visible = False
hWn = FindWindow("ieframe", vbNullString) 'Find the IExplorer window (Clsname="IEFrame")
'sending CTRL-i (Toggels the "Favorites" Window visible-invisible-visible, in German IExplorer)
PostMessage hWn, WM_KEYDOWN, VK_CONTROL, 0
PostMessage hWn, WM_KEYDOWN, Asc("I"), 0
PostMessage hWn, WM_KEYUP, Asc("I"), 0
PostMessage hWn, WM_KEYUP, VK_CONTROL, 0
End Sub


Sub sendAlt_DN()
'sends ALT-D-N (=File Menu, in German IExplorer)
PostMessage hWn, WM_SYSKEYDOWN, Asc("D"), &H20200001 'Alt-D Down
t = Timer: While Timer - t < 0.8: DoEvents: Wend
PostMessage hWn, WM_SYSKEYDOWN, Asc("N"), &H20200001 'Alt-N Down
End Sub










<img src="http://members.theglobe.com/HenryForts/Pusteblume.gif"><img src="http://members.theglobe.com/HenryForts/Pusteblume.gif">


Virtual-Key Codes

Const VK_LBUTTON = &H1
Const VK_RBUTTON = &H2
Const VK_CANCEL = &H3
Const VK_MBUTTON = &H4 ' NOT contiguous with L RBUTTON
Const VK_BACK = &H8
Const VK_TAB = &H9
Const VK_CLEAR = &HC
Const VK_RETURN = &HD
Const VK_SHIFT = &H10
Const VK_CONTROL = &H11
Const VK_MENU = &H12
Const VK_PAUSE = &H13
Const VK_CAPITAL = &H14
Const VK_ESCAPE = &H1B
Const VK_SPACE = &H20
Const VK_PRIOR = &H21
Const VK_NEXT = &H22
Const VK_END = &H23
Const VK_HOME = &H24
Const VK_LEFT = &H25
Const VK_UP = &H26
Const VK_RIGHT = &H27
Const VK_DOWN = &H28
Const VK_SELECT = &H29
Const VK_PRINT = &H2A
Const VK_EXECUTE = &H2B
Const VK_SNAPSHOT = &H2C
Const VK_INSERT = &H2D
Const VK_DELETE = &H2E
Const VK_HELP = &H2F

VK_0 30 0 key
VK_1 31 1 key
VK_2 32 2 key
VK_3 33 3 key
VK_4 34 4 key
VK_5 35 5 key
VK_6 36 6 key
VK_7 37 7 key
VK_8 38 8 key
VK_9 39 9 key
3A–40 Undefined
VK_A 41 A key
VK_B 42 B key
VK_C 43 C key
VK_D 44 D key
VK_E 45 E key
VK_F 46 F key
VK_G 47 G key
VK_H 48 H key
VK_I 49 I key
VK_J 4A J key
VK_K 4B K key
VK_L 4C L key
VK_M 4D M key
VK_N 4E N key
VK_O 4F O key
VK_P 50 P key
VK_Q 51 Q key
VK_R 52 R key
VK_S 53 S key
VK_T 54 T key
VK_U 55 U key
VK_V 56 V key
VK_W 57 W key
VK_X 58 X key
VK_Y 59 Y key
VK_Z 5A Z key
VK_LWIN 5B Left Windows key on a Microsoft Natural Keyboard
VK_RWIN 5C Right Windows key on a Microsoft Natural Keyboard
VK_APPS 5D Applications key on a Microsoft Natural Keyboard
5E–5F Undefined
VK_NUMPAD0 60 Numeric keypad 0 key
VK_NUMPAD1 61 Numeric keypad 1 key
VK_NUMPAD2 62 Numeric keypad 2 key
VK_NUMPAD3 63 Numeric keypad 3 key
VK_NUMPAD4 64 Numeric keypad 4 key
VK_NUMPAD5 65 Numeric keypad 5 key
VK_NUMPAD6 66 Numeric keypad 6 key
VK_NUMPAD7 67 Numeric keypad 7 key
VK_NUMPAD8 68 Numeric keypad 8 key
VK_NUMPAD9 69 Numeric keypad 9 key
VK_MULTIPLY 6A Multiply key
VK_ADD 6B Add key
VK_SEPARATOR 6C Separator key
VK_SUBTRACT 6D Subtract key
VK_DECIMAL 6E Decimal key
VK_DIVIDE 6F Divide key
VK_F1 70 F1 key
VK_F2 71 F2 key
VK_F3 72 F3 key
VK_F4 73 F4 key
VK_F5 74 F5 key
VK_F6 75 F6 key
VK_F7 76 F7 key
VK_F8 77 F8 key
VK_F9 78 F9 key
VK_F10 79 F10 key
VK_F11 7A F11 key
VK_F12 7B F12 key
VK_F13 7C F13 key
VK_F14 7D F14 key
VK_F15 7E F15 key
VK_F16 7F F16 key
VK_F17 80H F17 key
VK_F18 81H F18 key
VK_F19 82H F19 key
VK_F20 83H F20 key
VK_F21 84H F21 key
VK_F22 85H F22 key
VK_F23 86H F23 key
VK_F24 87H F24 key
88–8F Unassigned
VK_NUMLOCK 90 NUM LOCK key
VK_SCROLL 91 SCROLL LOCK key
VK_LSHIFT 0xA0 Left SHIFT
VK_RSHIFT 0xA1 Right SHIFT
VK_LCONTROL 0xA2 Left CTRL
VK_RONTROL 0xA3 Right CTRL
VK_LMENU 0xA4 Left ALT
VK_RMENU 0xA5 Right ALT
BA-C0 OEM-specific; reserved. See following tables.
C1-DA Unassigned
DB-E2 OEM-specific; reserved. See following tables.
E3 – E4 OEM-specific
E5 Unassigned
E6 OEM-specific
E7-E8 Unassigned
E9-F5 OEM-specific
VK_ATTN F6 ATTN key
VK_CRSEL F7 CRSEL key
VK_EXSEL F8 EXSEL key
VK_EREOF F9 Erase EOF key
VK_PLAY FA PLAY key
VK_ZOOM FB ZOOM key
VK_NONAME FC Reserved for future use
VK_PA1 FD PA1 key
VK_OEM_CLEAR FE CLEAR key


OEMs should make special note of the VK key ranges reserved for OEM-specific use: 2A, DB–E4, E6, and E9–F5.

In addition to the VK key assignments in the previous table, Microsoft has assigned the following OEM VK keys.

Symbolic constant Value (Hex) Mouse or keyboard equivalent
VK_OEM_SCROLL 0x91
VK_OEM_1 0xBA “;:” for US
VK_OEM_PLUS 0xBB “+” any country
VK_OEM_COMMA 0xBC “,” any country
VK_OEM_MINUS 0xBD “-” any country
VK_OEM_PERIOD 0xBE “.” any country
VK_OEM_2 0xBF “/?” for US
VK_OEM_3 0xC0 “`~” for US
VK_OEM_4 0xDB “[{” for US
VK_OEM_5 0xDC “|” for US
VK_OEM_6 0xDD “]}” for US
VK_OEM_7 0xDE “'"” for US
VK_OEM_8 0xDF
VK_OEM_AX 0xE1 AX key on Japanese AX keyboard
VK_OEM_102 0xE2 “<>” or “|” on RT 102-key keyboard







=======================================================================

If you want to send the string "Fo", post the following messages:


WM_KEYDOWN WKeyShift
WM_KEYDOWN WKeyF
WM_KEYUP WKeyF
WM_KEYUP WKeyShift
WM_KEYDOWN WKeyO
WM_KEYUP WKeyO


The destination application messageloop watches the keydown and keyup
messages and posts a WM_CHAR message for each ASCII keydown message it se=
es.
Also keystrokes messages are turned into WM_SYSKEYDOWN, WM_SYSCHAR, and
WM_SYSKEYUP messages for those that had the ALT key down at the time.


If you use SendMessage the messages are not translated in WM_CHAR.



========================================================================
· Nonsystem Keystroke

WM_KEYDOWNa key has been pressed
WM_KEYUPa key has been released
WM_CHARcontains the character code of a pressed key


· System Keystroke (While the Alt key is pressed)

WM_SYSKEYDOWNsystem key has been pressed
WM_SYSKEYUPsystem key has been released
WM_SYSCHARContains the character code while the Alt key is pressed

· A program normally ignore the system keystroke messages and pass them to DefWindowProc()


===========================
The lParam Variable

This 32-bit variable, with 6 fields, is passed to the WndProc()

Bit 0-15 Repeat count; the number of times of keystroke is repeated
Bit 16-23 8-bit OEM scan code
Bit 24 Extended key flag: 1 – extended key; 0 -- otherwise
Bit 25-28 Reserved
Bit 29 Context code: 1=Alt key is pressed; 0=otherwise (100000000000000000000000000000=&H20000000)
Bit 30 Previous key state: 0=previous key up, 1=previous key down (=40000000)
Bit 31 Transition state: 0 – WM_KEYDOWN, 1 – WM_KEYUP
========================================================================






<img src="http://www.bz-berlin.de/musik/awards/grandprix/gifs/bb19raab.gif">

Help Me About To Send Combo Key By "SendMessage"
Exactly the tille. I'd like to send combo key by "SendMessage".

If "SendMessage" can't do it, show me the other way to send combo key to the non-focus windows (Hide windows, mini wondows,...).

Who's help me? Plsssssss.......

Using SendMessage To Send "enter" To An App
I want to have a VB6 program open an app, then send a keystroke (enter) to the app. The app may or may not be in focus. I thought if I use SendMessage as shown below, this would work whether or not the app window is in focus...

SendMessage (Hwnd,WM_CHAR,13,ByVal 0)

I have two problems... first, I don't know what declarations need to be made for SendMessage. Last of all, I don't know how to get the Hwnd when I launch the app. I thought maybe it would be like this...

Hwnd = Shell("c:ProgramsMyApp.exe", vbNormalFocus)

I know this isn't correct, but I don't know how to do it. Any help would be appreciated!

Getting Keystrokes?
here is my thing.. i want that when you write in a textbox it appears like you are wrtiting another thing but the actual text you are inputing is saving ina varible..

example:
you see:
Hello my name is
and you are actually typing:
MundofrMundofr

i used to do this in Qbasic by usnig inkey$ i guess :P

many thanks
/Mundofr

Get The Keystrokes
hi,

how can i get all the keypressed when my app is active ?

my app contain a single form with many objects..

itz hard to do the keypress event code for all the objects..

please help

regards..

Keystrokes
i would like to make a program that get all key entered and put them in a file.
how can i do that?
thanks

Keystrokes
How can i detect keystrokes even if the form is hidden.

Keystrokes
Is it possible to write a program that simulates keystrokes on a keyboard? I found this class module, but I dont know how to activate it by clicking on a button on a form. I just started with Visual Basic, so I dont know much. I hope these forums help me learn.

KeyStrokes
I was thinking about creating a program which would press the key Ctrl in a certain window. I tryed using sendkeys and WM_KEYDOWN and it doesn't work quite that well. Is there any other way of coding it? Like apis? Thanks.

Keystrokes
I need to record every Key Stroke that is typed when this program is running and save it into a text file,
i know how to save it to a text, but its the recording keystroke part, something to do with ASCII
and how would i save these keys or would i put it write into the text file.

Thanks

Keystrokes
Hey, im making a keylogger program, an i wanna know when somoene is " typing " on your computer, how it will log them onto the txt file. This is waht i have on the code already.

Private Declare Function GetAsyncKeyState Lib "User32" _
(ByVal vKey As KeyCodeConstants) As Long

Using Keystrokes....
OK, I need a little help... I was wondering how to capture keystrokes. I'm making a little game here and was wonding how to use the arrow keys as controls.

I can build the logic behind this, but would just like a form to start with. When the form is up and you press either up, down, left or right it would return a message box.

I can do the rest...

Thanks for any help you can offer...

Shawn

Keystrokes
hi,



how can i get my app to pick up keystrokes (and save em) from anywherein windows.....

thanx in advance.

KeyStrokes
I made a program that would make a keystroke every 3 secs. But when I used it in a game, it didn't do anything. But, it did. For example if I wanted "3" to move, and I had that has the keystroke, I wouldn't move at all, but if I had the textbox open to chat to other players, it would be typing 333333... So, its working, but it only seems to be working as a string, not like the real key being pressed. Can anyone help me?

Function I am using is SendKeys
SendKeys "3"

Keystrokes
Hi,

I have a vb screen which needs to be unloaded after 5min, if there are no activites done on the screen ex: if there r no keystrokes or mouse clicks .
Can someone write me how to go about this.

Thanks a bunch!

Keystrokes
Is there a visualbasic code to record all keystrokes that are typed, while the visual basic program is running on the background?

Thx
Ben Reynders

Keystrokes
Hi list,

I'm delving into automation using VB...I am hoping to develop a simple automate procedure to use on MapInfo...this is my first keystroke code that I managed to find on the net...when I run it, and press the button nothing happens...it just sits there, it should close the window down...
any and all help would be appreciated
here's the code I'm using.

Declare Sub keybd_event Lib "user32.dll" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)



Private Sub Command1_Click()

Const KEYEVENTF_EXTENDEDKEY = &H1
Const KEYEVENTF_KEYUP = &H2

keybd_event VK_MENU, 0, 0, 0 ' press Alt
keybd_event VK_SPACE, 0, 0, 0 ' press Space
keybd_event VK_SPACE, 0, KEYEVENTF_KEYUP, 0 ' release Space
keybd_event VK_MENU, 0, KEYEVENTF_KEYUP, 0 ' release Alt

'Type the N key.
keybd_event VK_N, 0, 0, 0 ' press N
keybd_event VK_N, 0, KEYEVENTF_KEYUP, 0 ' release N
End Sub

Thanx
Ben

Keystrokes
How do i record a keystroke in a textbox?

How Do I Suppress Keystrokes???
I have a REALLY annoying problem with my current project - I am using Direct Input in a DD7 game using VB6.

Every time I hit a key while the game is running, the keystroke is implemented in the IDE, so that when I quit the game and get back to the code, I have "qpaoqoaqpaopoqpqpaoqpoa" written in the actual code. I copied the new code I have directly from another of my projects (which does NOT have this problem). I have changed all the form's properties so that they are identical in both projects, but the problem still persists. I've been trying to solve this problem for the last 3 hours, the relevant code is totally identical because I copied it, I can't understand why it's doing this! GOD I AM SO MAD!!

EDIT: PLEASE PLEASE PLEASE someone help me! It's been two days now, there MUST be a way of fixing this! Has anyone else had this problem?? Can anyone help me??

Sending Keystrokes
i am sending a text to an html form that contains java scripts. this form is displayed on a browser,but does not have a URL. it only has a title on its title bar.for example "flexcube - Internet Retail Banking".and i think i will reference the page with the title.users need to log in before the page will be displayed.the page contains some textboxes. please i need to send a text from my visual basic textbox to this form textbox. please this is on my neck urgently.

thanks

Capture Keystrokes In VB
Is it possible to capture these keys in VB?
Windows key + z = Msgbox "Windows key + z"
Alt + Shift + s = Msgbox "Alt + Shift + s"
Ctrl + Shift + a = Msgbox "Ctrl + Shift + a"

If yes, how?

Simulating Keystrokes
I'm trying to simulate keystrokes for any application in focus Using a hotkey. I have it working for the <space> key, but it won't seem to work for the quote key ("). Maybe someone can tell me what I'm doing wrong?

Const VK_Space = 32
Const VK_Quote = 34
Const KEYEVENTF_EXTENDEDKEY = &H1
Const KEYEVENTF_KEYUP = &H2
Private Declare Sub keybd_event Lib "user32.dll" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)

Private Sub VBHotKey1_HotkeyPressed()
keybd_event VK_Space, 0, 0, 0
keybd_event VK_Space, 0, KEYEVENTF_KEYUP, 0
keybd_event VK_Quote, 0, 0, 0
keybd_event VK_Quote, 0, KEYEVENTF_KEYUP, 0
End Sub


I'm using a hotkey, and I know the hotkey is working, because the space works, but the quote will not.

Any help would be much appreciated.
-Klownterfit

Sending Keystrokes
I have a handle to a certain window (a form) can i send a keystroke ALT+R like this?

SendMessage THWnd, WM_KEYDOWN, VK_R, 536870912

If yes why doesn't it work and if no tell me how i can accomplish this.

This should put a tick in a CheckBox on the form, should i Perhaps use the handle of the checkbox' window instead?

Thanks for the help.

Detecting Keystrokes
is there any way i can detect keystrokes or even check what has been pressed even outside the form. in this case, i want to detect if keycodes 178 or 179 have been pressed.

Thanks,
James

Capturing Keystrokes
I have this VB6 app with some controls on a form.

I want to interecept each keystroke before any control on the form sees the keystroke.

The form.keypreview=true is NOT working. I don't know why. I suspect it is caused by a 3rd party control I'm using.

Is there another way to capture the keystroke other than using (formname).preview=true? I might have to use the Windows API but I thought I'd try here first.

Timed KeyStrokes?
How would i be able to tell how long a button has been pressed for? Eg:

If Spacebar was pressed for 3 seconds then
....
elseif Spacebar was pressed for 4 seconds then
...

Restricting Keystrokes
I'm working on restricting keystrokes on some combo and text boxes. I've been using the keypress event and I easily figured out how to capture the keystrokes and change them to a different keystroke, but I can't figure out how to just ignore the keystroke Ex: They type "*" I don't want anything to appear in the textbox. I can achieve this if I put up a message box or print the keystroke to the immediate window but I really don't want to do that. Are there any other alternatives?

Intercepting Keystrokes
I was wondering if there was a way to make intercepted keystrokes work system wide. Example: Change F10 to ESC, have my app running in the background and have it affect all programs running on the system. I know how to intercept keystrokes for my app, it's the having it affect other programs part I don't know.

Thanks.

"If you would have been listening, you would have heard what I meant to say." -Rod McKuen

Recording Keystrokes
I need help recording keystrokes from other programs. I want to be able to save what's been typed from other programs, not just mine. So basically, anything typed in the keyboard is what I would want to be saved. NE1 who can help, please do! I'm really stumped.

Simulating Keystrokes In VB6
I am trying to make a program, and I need some code that will simulate pressing the enter key, to control another program. Thanks!

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