Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

A question on Shell function

Posted on 1998-12-29
3
Medium Priority
?
188 Views
Last Modified: 2010-05-03
hi,
I make .exe for an application and use Shell to activate it
in a menu option. The application is activated but is minimised. I check the windowstate of the form and it's Normal.

Please advise how i can activate the application and make it
normal instead of minimised?

Thanks.
Andrea
0
Comment
Question by:tanmh
[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
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
hddp666 earned 40 total points
ID: 1453136
When you call the program using the shell function, make sure that you include the windowstyle argument. It's optional, but the default is the window minimized. Here is the syntax:

Dim r as long ' value returned by program
r = Shell(pathname[,windowstyle])
r = Shell(C:\program.exe, 1)

pathname = "c:\windows\notepad.exe c:\My Documents\resume.txt"

This will open resume.txt using notepad.exe

pathname = "c:\applications\MyProgram.exe"

This will run MyProgram.exe


windowstyle value      window state upon execution

0      Window is hidden and focus is passed to the hidden window.
1      Window has focus and is restored to its original size and position.
2      Window is displayed minimized (taskbar icon) with focus.
3      Window is maximized with focus.
4      Window is restored to its most recent size and position. The currently active window remains active.
6      Window is displayed as an icon. Current window remains active.

vbHide                      0      
vbNormalFocus              1      
vbMinimizedFocus      2      
vbMaximizedFocus      3      
vbNormalNoFocus              4      
<NONE>                 <5>
vbMinimizedNoFocus      6


0
 

Author Comment

by:tanmh
ID: 1453137
hi,
thanks for the answer. it works!!!
just for clarification, why can't i set the window state in the form properties?

andrea
0
 
LVL 1

Expert Comment

by:hddp666
ID: 1453138
It's anybody's guess why the shell function ignores the windowstate property that is set at design-time. Maybe VB6.0 will have this bug fixed.
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

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…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…
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…
Suggested Courses

722 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