Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > How Do I Send a Keystroke Sequence within VB?


Reply
 
Thread Tools Display Modes
  #1  
Old 02-08-2005, 05:56 PM
dsutter9 dsutter9 is offline
Newcomer
 
Join Date: Jul 2003
Location: Cary, NC
Posts: 18
Default 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.
__________________
Don
Reply With Quote
  #2  
Old 02-08-2005, 05:58 PM
tidy trax tidy trax is offline
Centurion
 
Join Date: Aug 2004
Location: England
Posts: 171
Default

SendKeys "^{END}"
SendKeys "{DOWN 3}"
__________________
- tidy trax
Reply With Quote
  #3  
Old 02-09-2005, 07:15 AM
dsutter9 dsutter9 is offline
Newcomer
 
Join Date: Jul 2003
Location: Cary, NC
Posts: 18
Default

I am trying to send this sequence to a word document. For some reason it doesn't seem to be working.

I am using the Sendkeys ("^{end}")

It just seems to ignore this command. I can stop the program at the point where I want to send this command and go to the Word window and hit those keys and it does what I want. When I let the Sendkeys command run, it doesn't do anything.

Help.
__________________
Don
Reply With Quote
  #4  
Old 02-09-2005, 07:58 AM
charlie's Avatar
charlie charlie is offline
Senior Contributor
 
Join Date: Jul 2003
Location: Barcelona (SPAIN)
Posts: 1,056
Default

Has the document the focus? Try sending Alt+F4. If it closes then it has got the focus. If don't it hasn't got the focus.
__________________
01000011011010000110000101110010011011000110100101100101
~ En mi vida sólo hay dos días que no me importan: ayer y mañana ~
Reply With Quote
  #5  
Old 02-09-2005, 08:03 AM
dsutter9 dsutter9 is offline
Newcomer
 
Join Date: Jul 2003
Location: Cary, NC
Posts: 18
Default

It doesn't seem to have the focus. How would I change the focus to the Word application before I send the Sendkeys command?
__________________
Don

Last edited by dsutter9; 02-09-2005 at 08:36 AM.
Reply With Quote
  #6  
Old 02-09-2005, 11:15 AM
tidy trax tidy trax is offline
Centurion
 
Join Date: Aug 2004
Location: England
Posts: 171
Default

Use Appactivate, you must know the titlebar text for that though.

AppActivate "Titlebar Text"
__________________
- tidy trax
Reply With Quote
  #7  
Old 02-09-2005, 11:49 AM
dsutter9 dsutter9 is offline
Newcomer
 
Join Date: Jul 2003
Location: Cary, NC
Posts: 18
Default

That did the trick.

Thank you very much.
__________________
Don
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->