Re: Issues with the Shell Command - Alternate Solutions?



IMHO Shell is unstable and I find I get better results using ExecCmd
See link for details
http://www.vbcity.com/forums/topic.asp?tid=8463

Cheers

Ian B


"'69 Camaro" <ForwardZERO_SPAM.To.69Camaro@xxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:0125D889-5440-493A-A6DD-C5AAD01010F5@xxxxxxxxxxxxxxxx
> 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.
>
>
> "Tatakau" wrote:
>
> > 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


.