Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2004-10-01
7
Medium Priority
?
401 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 375 total points
ID: 12199820
same API just use
Public Const SW_HIDE = 0

ShowWindow( hWndDOS,SW_HIDE)

0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
Suggested Courses

885 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