[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

In VB need to get processId from Wscript.Shell or need to bring focus to window that I launch from Shell("some.exe")

Posted on 2004-08-16
8
Medium Priority
?
1,089 Views
Last Modified: 2012-08-14
In the VB exe I am making I launch an exe and want to wait for it to return.   However in the code that waits for the exe to finish running uses a processID.  My problem is that I when i use the command Shell("nameofexe.exe") it launches the exe but does not show the window.  (It is a minimized window)  I then tried using Wscipt since I knew this would show the window.

Set WshShell = CreateObject("WScript.Shell")
installerId = WshShell.Run(".\Installer.exe")  

However this presented the problem that WshShell.Run(".\Installer.exe") does not return a process Id.  So if anyone can tell me how to either get the processId from Wscript.run or tell me how to make the window not be minimized when i run:

installerId = Shell(".\Installer.exe")

i would be very grateful and reward them the points.  Thanks in advance.
0
Comment
Question by:jstreb
[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
  • 4
  • 2
8 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 11811635
What are you trying to accomplish here with the WshShell?  You can use this instead:

Dim p As New Process
p.StartInfo.UseShellExecute = False
p.StartInfo.RedirectStandardOutput = True
p.StartInfo.Arguments = myargumentstring
p.StartInfo.WorkingDirectory = myworkdirectorystring
p.StartInfo.FileName = "C:\myprogram"
p.Start
p.WaitForExit()

Bob
0
 

Author Comment

by:jstreb
ID: 11812197
Basically I need to run through a seperate installer and make sure that that program is installed first before I proceed with anything else in my program.  All I want to do is launch that .exe and show the install wizard to the user and then proceed with my exe when they have finished with the install wizard.

I tried using your code you posted but I got a compile error of: = expected for the line p.WaitForExit().  I am using VB 6.0, don't know if that could be the cause.  Thanks though.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 11812238
Well, this is the VB.NET topic area.  You might want to post a free question in Community Support and ask for this question to be moved to http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/.

Community Support:
http://www.experts-exchange.com/Community_Support/

Bob
0
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!

 

Author Comment

by:jstreb
ID: 11813919
Well i found the an answer for those who are curious in the future.  The shell command can take in arguments to determine focus and size.  I ended up using the command:

installerId = Shell(".\Installer.exe", vbNormalFocus) and this did the trick.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 11814043
Good, I'm glad you found your answer.

Bob
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 11814052
You can post a free question in the Community Support topic area and ask them to PAQ this question and refund your points.

Bob
0
 
LVL 1

Accepted Solution

by:
DarthMod earned 0 total points
ID: 12143509
Submitted to PAQ with no points refunded (of 125)

DarthMod
Community Support Moderator
0

Featured Post

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.

Question has a verified solution.

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

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

650 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