Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

sendkeys

Posted on 2001-06-22
8
Medium Priority
?
343 Views
Last Modified: 2010-08-05
What do I need to add to this --

I'm trying to run setup.exe and have(enter) pressed when the dialog pops up???




Private Sub form_load()



Shell ("command.com /c c:\windows\desktop\setup.exe"), vbHide
SendKeys (enter)
End Sub
0
Comment
Question by:patrickm3
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 6

Expert Comment

by:JonFish85
ID: 6220522
AppActivate "Caption Of Setup.exe"
SendKeys "{ENTER}", True
0
 

Expert Comment

by:RichardVBman
ID: 6220540
I agree with JonFish85; you might also need to create a time delay between the activation of the form and the sendkeys statement (you'll need to adjust the forms timer interval to suit your own needs):

AppActivate"Caption Of Setup.exe"
Call Delay(10)
SendKeys "{ENTER}",True

'Paste this Function in the declarations section

Function Delay(lngDelay as long)

dim StartTime as long

StartTime = Timer
While Timer <> StartTime + lngDelay
   Doevents
Wend

End sub
0
 
LVL 6

Expert Comment

by:JonFish85
ID: 6220577
Hello RichardVBMan! I notice that you are fairly new to EE. Here at EE, experts usually choose to post always with comments, as a proposed answer locks the question and moves it to the "Answered Questions" section. Also, your "answer" is basically the same as mine, just with revisions. Please just keep in mind that it is generally better to just use comments, since the questionerre can accept a comment as an answer. Just thought I'd let you know!
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:patrickm3
ID: 6223168
I've never used vb--could you tell me where to paste this stuff in?
0
 

Author Comment

by:patrickm3
ID: 6223189
I've never used vb--could you tell me where to paste this stuff in?
0
 
LVL 6

Accepted Solution

by:
JonFish85 earned 600 total points
ID: 6223514
try something like this:

Private Sub Form_Load()
  Shell "C:\Path\To\Setup\Setup.exe", vbNormalFocus
  DoEvents
  DoEvents
  'Replace "caption" with the caption of
  'the main setup.exe
  AppActivate "Caption", True
  DoEvents
  SendKeys "{ENTER}", True
End Sub
0
 
LVL 1

Expert Comment

by:Form_Glow
ID: 6224809
Why use SENDKEYS?
Just Loop until you get the handle of the "OK" button or whatever..

Do:Doevents
x = get the handle of button to click
loop until x

Call SendMessage(x, WM_LBUTTONDOWN, 0&, 0&)
Call SendMessage(x, WM_LBUTTONUP, 0&, 0&)
 
0
 
LVL 6

Expert Comment

by:JonFish85
ID: 6494593
thanks for the points, but why the B grade?
0

Featured Post

Industry Leaders: 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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

688 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