Issues with the Shell Command - Alternate Solutions?

T

Tatakau

I have an old network database program that I am trying to open from an
Access database. I tried using the Shell command, but it doens't seem to be
working. Well, it works in most instances, but with this particular program
it is having an issue.

The program I am trying to run is called SMS Host and it is stored on a
network drive (T:). The full path to the program is:
"T:\HOSTPLUS\fxp32\INFRAMV.EXE". This is how I try to run it:

stAppName = "T:\HOSTPLUS\fxp32\INFRAMV.EXE"
Call Shell(stAppName)

When I click the button to activate that code, the program semi-opens, but
with a lot of errors.

The window title is "Microsoft Visual FoxPro", which is probably the shell
program that runs the database, or telnets into the database. I get a slew
of error messages, all leading me to believe that the program is missing
arguments at run-time or something. Which is weird though, because the
shortcut that is used to run the program doesn't contain any arguments at all.

When I go to the Start > Run box and type in the path
(T:\HOSTPLUS\fxp32\INFRAMV.EXE) it will start up just fine.

Using the shell command for other programs (ie, notepad, internet explorer,
etc) works just fine.

There is something about the Shell command that changes how the called
program is started up. Due to the program's nature (being on the network,
and probably being some sort of telnet), it needs a different method to
execute the program.

Are there any other ways to execute a program besides the Shell command?

Thanks!

Nick
 
R

Roger Carlson

Try changing the WindowStyle parameter. Might not help, but it can't hurt
to try.
From Access Help:
' Specifying 1 as the second argument opens the application in
' normal size and gives it the focus.
Dim RetVal
RetVal = Shell("C:\WINDOWS\CALC.EXE", 1) ' Run Calculator.
-- Other parameters are vbHide 0vbNormalFocus
1vbMinimizedFocus 2vbNormalNoFocus 4vbMinimizedNoFocus 6--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com Want answers to your
Access questions in your Email? Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L"Tatakau"
 
T

Tatakau

Tried that already. Doesn't make a difference.

Roger Carlson said:
Try changing the WindowStyle parameter. Might not help, but it can't hurt
to try.
From Access Help:
' Specifying 1 as the second argument opens the application in
' normal size and gives it the focus.
Dim RetVal
RetVal = Shell("C:\WINDOWS\CALC.EXE", 1) ' Run Calculator.
-- Other parameters are vbHide 0vbNormalFocus
1vbMinimizedFocus 2vbNormalNoFocus 4vbMinimizedNoFocus 6--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com Want answers to your
Access questions in your Email? Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L"Tatakau"
 
6

'69 Camaro

Hi.
I get a slew
of error messages, all leading me to believe that the program is missing
arguments at run-time or something.

You are correct.
Which is weird though, because the
shortcut that is used to run the program doesn't contain any arguments at all.

It's not weird at all. What few Windows users realize is that simple
operations (such as double-clicking on a shortcut's file name on the Windows
Desktop) give commands to the operating system to "do this for me
automatically," and a whole lot of work gets done by the CPU without the user
doing anything or thinking about anything else. The Windows Registry
settings help automate a lot of these processes.

Essentially, if you don't offer command-line parameters within the Windows
GUI, then you get the "one size fits all" default settings as stored in the
Windows Registry for the executable file you've just launched. The
particular application you are launching will fail without those settings.
(Hence, those annoying error messages.)

So the shortcut is using the default Windows Registry settings. Your Shell(
) command code doesn't offer those command-line arguments, which means your
code is specifically requiring that _no_ command-line arguments be used when
the application launches. (Shell( ) isn't using the Windows Registry,
because it's shelling out to the operating system to give it your commands
directly.) You need to figure out what those command-line arguments are so
that your code doesn't fall flat on its face.

You can get these settings from the Windows Registry or you can usually find
the default settings for this particular executable and use them in your
code. (Since you didn't mention which operating system you are using, I get
to assume that you are using the same one I am. ;-))

To do so, open Windows Explorer. Select the Tools -> Folder Options...
menu. Select the "File Types" tab. Scroll down until you find the file name
extension for the files that INFRAMV.EXE opens. (If you don't know, then I
can't help you, but you might get some clues by looking at the file types,
file extensions, and file icons to see if you can find any that look
famililar.) Select the "Advanced" tab.

You'll see a list box full of "Actions." The action with bold type is the
default action that Windows will take when no command-line parameters are
given when the application launches. Select this action, then select the
"Edit..." button. Check the "Application used to perform action" text box
and see what the path, file name and arguments are. That's what your code
needs. I don't have your application on my computer so I don't know what
command-line arguments it needs, but to print a PowerPoint slide, I'd need
the following in my Shell( ) code:

"C:\Program Files\Microsoft Office\OFFICE11\POWERPNT.EXE" /p "%1"

.... where "%1" would be replaced with the full path and name of the file to
be printed. Perhaps your code needs something like:

stAppName = "T:\HOSTPLUS\fxp32\INFRAMV.EXE" "/run C:\MyPath\Myfile.db"
Using the shell command for other programs (ie, notepad, internet explorer,
etc) works just fine.

Of course. These applications don't require command-line arguments when
launched, so they won't fall flat on their faces like your application does.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.
 
D

Douglas J. Steele

Not within the Shell command, but before you invoke it:

CurDir("T:\HOSTPLUS\fxp32\")
stAppName = "T:\HOSTPLUS\fxp32\INFRAMV.EXE"
Call Shell(stAppName)
 
T

Tatakau

Very very very good idea! But unfortunately, it didn't work. :p Thank you
though!

Nick
 
D

Dirk Goldgar

Douglas J. Steele said:
Not within the Shell command, but before you invoke it:

CurDir("T:\HOSTPLUS\fxp32\")

Shouldn't that have been

ChDir "T:\HOSTPLUS\fxp32\"

?
 
T

Tatakau

That didn't do it either. lol, this thread is becoming entirely too long.
thank you so much for taking the time to help!

Nick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top