VB 6 SendKeys

August 24, 2009 at 04:40:03
Specs: DOS
Hi
I have a problem with VB 6 :

This is my code :

Private Sub Form_Load()
shell ("c:\nc\nc" , 1 )
SendKeys "{enter}"

End Sub

It just opens NC.exe & after that any action !
...
Thnx

Impossible is nothing !!!


See More: VB 6 SendKeys

Report •


#1
August 24, 2009 at 06:25:58
Is the application expecting keyboard input?

Are you sending the sendkeys before the application has loaded and is ready to recieve input?

A delay beween the Shell and Sendkeys will give the application time to load and initialise. A few milli seconds can make all the difference.

Stuart


Report •

#2
August 24, 2009 at 10:24:02
OS: DOS
Your OS isn't DOS. If it's Vista or Win7, you need to move to another version of VB, as VB6's SendKeys() does not work under the newer OS'es. If it's XP or 2K, then you're not waiting long enough, as StuartS suggests.

Report •

#3
August 24, 2009 at 11:33:52
now I'm working on it with XP's cmd but in fact I need it on real dos.
I dont want to use any keyboard . dos machine is embeded & withaou keyboard or monitor .
I'd installes NC(Norton Commander) on it & I want it automatically run NC & does the linking oparation like :
First it should press F9
Then "L" to select left menu
& "K" to link
& "alt + L" to start linking

Thanks for your attention

Impossible is nothing !!!


Report •

Related Solutions

#4
August 24, 2009 at 13:00:05
now I'm working on it with XP's cmd but in fact I need it on real dos.

In that case you are probably wasting yout time.

VB6 needs Windows 95 at least. It does not run under real DOS. The last vrsion of VB to run under DOS was VB2.

Stuart


Report •

#5
August 24, 2009 at 22:20:39
Does VB 2 have SendKeys function & Does it's .exe file run on dos ?

Impossible is nothing !!!


Report •

#6
August 25, 2009 at 04:44:10
A VB2 compiled programme should run on DOS but I very much doubt it will have a sendkeys function.

Sendkeys relies on the multitasking abilities of Winodws. There is no multitasking in DOS. If you want one application to pass values to another in DOS then you are going to have do do some pretty low level programming. In DOS only one application can be running at a time.

Then you have to find a copy of VB2

Stuart


Report •

#7
August 25, 2009 at 11:04:28
mohandese: Does VB 2 have SendKeys
I think SendKeys works by sending a message to the active window. DOS doesn't use Windows' messaging system. (So even if VB2 had SendKeys(), it would not help you.)

If it's pure DOS, then you might be able to use standard I/O.

yourExe < lstOfKey.s


Report •

#8
August 25, 2009 at 21:56:41
By the way thanx all of U ...
It was helpful , I learned something .

Impossible is nothing !!!


Report •

#9
September 17, 2009 at 09:51:57
I seem to recall having a actual MS-DOS 6.22 utility that would store into the DOS keyboard buffer a key sequence, then the program executing afterward would received that input. I might be able to search my old ZIP disks and see what it was. I used it in batch files to pre-load keyboard commands for dos apps.

Report •


Ask Question