Solved

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

Posted on 2004-10-01
7
352 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now