How do i use sendkey with a cmd window 
Author Message
 How do i use sendkey with a cmd window

Hi, i am having trouble using sendkeys to a cmd window in windows 2k using
vb6. I can get it to work to notepad but not to cmd. i am using something
like this.

Private Sub
Command1_Click()
Shell "cmd"
Appaptivate "cmd.exe"
sendkeys "Hello world"

Regards Andrew



Wed, 17 Nov 2004 16:40:12 GMT  
 How do i use sendkey with a cmd window
Try this:

Option Explicit

Private Sub Command1_Click()

Dim Handle As Long
Dim i As Integer

Handle = Shell("cmd.exe")

For i = 1 To 10000
     DoEvents
Next

AppActivate Handle

SendKeys "Hello World"

End Sub

Or you can try WriteConsole API to write a character string to a console
screen buffer.

HOWTO: Attach a Console Window to Your Visual Basic Program   [vbwin]
http://support.microsoft.com/support/kb/articles/q171/6/54.asp

Best Regards,

Alick Ye

This posting is provided "AS IS" with no warranties, and confers no rights.

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

Newsgroups: microsoft.public.vb.controls
Subject: How do i use sendkey with a cmd window
Lines: 16
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Organization: Ye 'Ol Disorganized NNTPCache groupie


X-Cache: nntpcache 3.0.1 (see http://www.nntpcache.org/)
NNTP-Posting-Date: Sat, 01 Jun 2002 03:40:12 CDT
X-Trace:
sv3-tROVycM0lfgG/P/nNaB9kc5i5Z+7fVcCHcOz6tDQX1/uLruMMYgj65wlMa3LhwKTIfAi1HQ0
+L7dAGI!2BXrd4lBqcGzGAVUU1rsjp+F1Kekbja44RAY4DhN/tXxVZ9c25Yc4TBmuww7mEwV/0o/
/N6NOGMO!4TYAMwYadA==

X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-Info: Please be sure to forward a copy of ALL headers
X-Abuse-Info: Otherwise we will be unable to process your complaint properly
Date: Sat, 01 Jun 2002 08:40:12 GMT
Path:
cpmsftngxa07!tkmsftngxs01!tkmsftngxs02!tkmsftngp01!newsfeed00.sul.t-online.d
e!t-online.de!newsfeed.icl.net!opentransit.net!border1.nntp.aus1.giganews.co
m!nntp.giganews.com!nntp3.aus1.giganews.com!bin4.nnrp.aus1.giganews.com.POST
ED!not-for-mail
Xref: cpmsftngxa07 microsoft.public.vb.controls:131769
X-Tomcat-NG: microsoft.public.vb.controls

Hi, i am having trouble using sendkeys to a cmd window in windows 2k using
vb6. I can get it to work to notepad but not to cmd. i am using something
like this.

Private Sub
Command1_Click()
Shell "cmd"
Appaptivate "cmd.exe"
sendkeys "Hello world"

Regards Andrew



Fri, 19 Nov 2004 16:19:39 GMT  
 How do i use sendkey with a cmd window
Thanks. Andrew

Quote:
> Hi, i am having trouble using sendkeys to a cmd window in windows 2k using
> vb6. I can get it to work to notepad but not to cmd. i am using something
> like this.

> Private Sub
> Command1_Click()
> Shell "cmd"
> Appaptivate "cmd.exe"
> sendkeys "Hello world"

> Regards Andrew



Sat, 20 Nov 2004 02:36:12 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. doing actions on cmd.exe window

2. Sendkey to found window using FindWindow

3. Creating and environment variable and using it in the same cmd window

4. Creating and environment variable and using it in the same cmd window

5. changing cmd window icon does work when using compiled EXE

6. Naming The CMD Window Using Shell?

7. SendKey, Reboot machine and complete install with Sendkey

8. SendKey Function in a DOS window

9. sendkey to dos window

10. set rs = cmd.Execute fails when cmd.CommandText includes spaces

11. Access 8.0: NumLoc automatically turns off when using SendKey

12. Help using the SendKey command

 

 
Powered by phpBB® Forum Software