Solved

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

Posted on 2004-10-01
7
356 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
  • 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
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: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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

679 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