?
Solved

Is it possible?

Posted on 2000-04-12
7
Medium Priority
?
117 Views
Last Modified: 2010-05-02
I want run self extracting file from VB.
That file will be run in DOS window.
And ask me enter Yes(Y) or No(N),and
Enter after that.How can i do it in VB
insted of user (i want that user will not press any key).

Thanks in advance!
0
Comment
Question by:mikef17
7 Comments
 
LVL 43

Expert Comment

by:TimCottee
ID: 2706901
Use SendKeys

Private Sub Command2_Click()
Dim dblProcID As Double
dblProcID = Shell("SelfExtractingEXE.EXE")
AppActivate (dblProcID)
SendKeys "Y{ENTER}"

End Sub
0
 

Author Comment

by:mikef17
ID: 2707416
Hi,TimCottee!
Thanks for response.

This code not work properly.
Sendkeys function not works.
What possible problem???
0
 
LVL 1

Expert Comment

by:freg
ID: 2708022
I think that the code from TimCottee is right, but the SendKey is probably sent too soon.  In fact, as soon as the dos shell is launched (with de self-extract file running), the vb code continue and then the 'Y' + 'ENTER' keys are sent, even before the question (Y / N ?) is asked.  Find a way to send the key later.

An other solution would be using ShellExecute and pass a parameter to the self-extractingExe (ex.: /Y).  Try it.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 9

Accepted Solution

by:
samopal earned 200 total points
ID: 2708114
SendKey doesn't work with console application. Here is a solution:

Create file yes.txt with 3 bytes only. First byte is "Y", 2 last bytes- (0D 0A)hex

In VB programm

Shell "C:\..\Prog.exe <C:\..\yes.txt"

HTH
0
 

Author Comment

by:mikef17
ID: 2710742
Hi,samopal!
What exactly i need type in text file
(i can't enter bytes?!)
0
 
LVL 9

Expert Comment

by:samopal
ID: 2712135
Ok. Open Notepad, press <Y> and <Enter>. Save this file as "Yes.txt" The length of this file should be 3 bytes, and no bit more! :-))
0
 

Author Comment

by:mikef17
ID: 2725270
Hi,samopal!
That's not work.May be self extracting file need some waiting time?
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month13 days, 13 hours left to enroll

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question