Solved

An extreme ......Shell window problem in VB6

Posted on 2004-10-01
7
361 Views
Last Modified: 2010-05-02
In my VB6 application I make a Shell call to another "exe" application which executes or pops-up an MS-DOS window and then displays a graph window. Therefore there are two windows poped-up when the VB application executes the Shell command.

However, I wish that the MS-DOS window get minimised while the other window (one with a graph) remains open. I have tried using Shell("myapplication.exe",vbHide) and also Shell("myapplication", vbMinimizedNoFocus) with the result that, my graph window also gets hidden or minimised which is not what I want.

Any help is most wanted and welcomed...please...


Help me out...

Josh
0
Comment
Question by:gotiya
[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
  • 3
  • 2
7 Comments
 
LVL 43

Expert Comment

by:TimCottee
ID: 12198569
Hi gotiya,

The problem is perhaps out of your control! It depends on the application you are shelling out to. If it has control over its child windows and therefore minimises them when it is minimised itself then it could be tricky to work around.

However you could use a combination of API calls such as FindWindow to get a handle to the DOS window

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function ShowWindow Lib "user32" Alias "ShowWindow" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Const SW_MINIMIZE = 6

Private Sub Launch_Click()
 Shell "......."
 Dim hWndDOS As Long
 hWndDOS = FindWindow(vbNullString,"The name of the DOS window (Its Exact title)")
 ShowWindow( hWndDOS,SW_MINIMIZE)
End Sub

Tim Cottee
Brainbench MVP for Visual Basic
http://www.brainbench.com
0
 

Author Comment

by:gotiya
ID: 12198759
Hi Tim,

Thank u for ur responce. However, I tried using the API call but it does not seem to work. I think the application does has a control over the child window. Let me ask you if there is an API call to HideWindow just like the one you showed earlier ShowWindow ?
0
 
LVL 1

Accepted Solution

by:
VBtorment earned 125 total points
ID: 12199820
same API just use
Public Const SW_HIDE = 0

ShowWindow( hWndDOS,SW_HIDE)

0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Author Comment

by:gotiya
ID: 12225015
thank you VNtorment
It does work.
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 12563407
Just split the points evenly I guess, the ShowWindow works, just with hide not minimize as supplied by VBtorment.
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 12586980
Or not as the case may be!
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: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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 Month8 days, 3 hours left to enroll

617 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