I still have yet to learn about ShellExecute and would like to continue
to use the RUN command because of the ability to leverage the "File
Association" aspects of windows.

In the CMD.COM and COMMAND.COM environment using the windows start menu
"run" command, from the command prompt;

START <filename.ext>

...will launch the users application of choice for that file extension,
but VFP's "RUN" command launches NTVDM.EXE which seems to be a pretty
crippled command shell... START for one won't work.

I can address this by replacing the FOXRUN pif with a copy of the
windows DOS pif, but would like some wisdom on what NTVDM.EXE is and how
others deal with it.

Thanks in advance,
Beverly Howard

Re: RUN Question by Josh

Josh
Sun Sep 23 16:15:22 PDT 2007


what are you trying to achieve? Why don't you want to use ShellExecute() - it
gives more control over run -- and still uses windows file association
management... Or you can combine it with FindExecutable() to have complete
control.


On Sun, 23 Sep 2007 17:15:59 -0500, "Beverly Howard [Ms-MVP/MobileDev]"
<BevNoSpamBevHoward.com> wrote:

>I still have yet to learn about ShellExecute and would like to continue
>to use the RUN command because of the ability to leverage the "File
>Association" aspects of windows.
>
>In the CMD.COM and COMMAND.COM environment using the windows start menu
>"run" command, from the command prompt;
>
>START <filename.ext>
>
>...will launch the users application of choice for that file extension,
>but VFP's "RUN" command launches NTVDM.EXE which seems to be a pretty
>crippled command shell... START for one won't work.
>
>I can address this by replacing the FOXRUN pif with a copy of the
>windows DOS pif, but would like some wisdom on what NTVDM.EXE is and how
>others deal with it.
>
>Thanks in advance,
>Beverly Howard


Re: RUN Question by Dan

Dan
Sun Sep 23 16:33:29 PDT 2007

I agree with Josh. It may just be time to bite the bullet and start using
ShellExecute(), or the equivalent provided by the scripting host.

But check out command.com /c -- ISTR it would make START work. i.e.:

RUN COMMAND.COM /C START <your command here>

Of course, also check it out with RUN /N

This is another of those little rabbit trails that can consume endless hours
while you figure out which combinations work and which don't.

Dan

Beverly Howard [Ms-MVP/MobileDev] wrote:
> I still have yet to learn about ShellExecute and would like to
> continue to use the RUN command because of the ability to leverage
> the "File Association" aspects of windows.
>
> In the CMD.COM and COMMAND.COM environment using the windows start
> menu "run" command, from the command prompt;
>
> START <filename.ext>
>
> ...will launch the users application of choice for that file
> extension, but VFP's "RUN" command launches NTVDM.EXE which seems to
> be a pretty crippled command shell... START for one won't work.
>
> I can address this by replacing the FOXRUN pif with a copy of the
> windows DOS pif, but would like some wisdom on what NTVDM.EXE is and
> how others deal with it.
>
> Thanks in advance,
> Beverly Howard



Re: RUN Question by Beverly

Beverly
Mon Sep 24 14:27:15 PDT 2007

>> Why don't you want to use ShellExecute() - it gives more control
over run <<

Will head that way... however, ShellExecute() doesn't seem to be part of
the default vfp7 install and the help file hasn't.

Pointers to a source for a newbie would be welcome.

>> what are you trying to achieve <<

Primarily, using file and type associations to fit user expectations...
for example, having a text file open in the editor they expect or using
a mailto: to trigger their own email client whatever that might be.

Thanks,
Beverly Howard


Re: RUN Question by Beverly

Beverly
Mon Sep 24 14:31:22 PDT 2007

>> But check out command.com /c -- ISTR it would make START work. i.e.:

RUN COMMAND.COM /C START <your command here>

Of course, also check it out with RUN /N <<

That's sort of painful from a resource standpoint as it ends up with two
command shells running to accomplish any simple command prompt task ;-)

For the moment, replacing the default foxrun pif file with the generic
windows dos pif meets the need... am looking forward to learning how to
use the shellexecute() methods.

Thanks,
Beverly Howard



Re: RUN Question by Dan

Dan
Mon Sep 24 14:54:04 PDT 2007

Beverly Howard [Ms-MVP/MobileDev] wrote:
>>> But check out command.com /c -- ISTR it would make START work. i.e.:
>
> RUN COMMAND.COM /C START <your command here>
>
> Of course, also check it out with RUN /N <<
>
> That's sort of painful from a resource standpoint as it ends up with
> two command shells running to accomplish any simple command prompt
> task ;-)
> For the moment, replacing the default foxrun pif file with the generic
> windows dos pif meets the need... am looking forward to learning how
> to use the shellexecute() methods.

Take a look at the _shellexecute class in (_samples + "Ffc\environ.vcx").
It's a sample implementation of the Win32 API call.

Or this:

oShell = Createobject("Shell.Application")

Then use Intellisense to check out the ShellExecute() method and its params.

There's a sort of embarrassment of riches here. <g>

Dan



Re: RUN Question by Beverly

Beverly
Mon Sep 24 16:23:13 PDT 2007

Thanks... for continuing support. Will be back when I break my nose
running into the shell ;-)

Beverly Howard


Re: RUN Question by Roger

Roger
Mon Sep 24 19:35:56 PDT 2007


"Beverly Howard [Ms-MVP/MobileDev]" <BevNoSpamBevHoward.com> wrote in message
news:ev$uuGv$HHA.4612@TK2MSFTNGP03.phx.gbl...
> >> Why don't you want to use ShellExecute() - it gives more control
> over run <<
>
> Will head that way... however, ShellExecute() doesn't seem to be part of the default vfp7 install
> and the help file hasn't.
>
> Pointers to a source for a newbie would be welcome.

http://msdn2.microsoft.com/en-us/library/ms647732.aspx


The nShowCmd constants are:
SW_HIDE (0)
Hides the window and activates another window.
SW_MAXIMIZE (3)
Maximizes the specified window.
SW_MINIMIZE (6)
Minimizes the specified window and activates the next top-level window in the z-order.
SW_RESTORE (9)
Activates and displays the window. If the window is minimized or maximized, Windows restores it to
its original size and position. An application should specify this flag when restoring a minimized
window.
SW_SHOW (5)
Activates the window and displays it in its current size and position.
SW_SHOWDEFAULT (10)
Sets the show state based on the SW_ flag specified in the STARTUPINFO structure passed to the
CreateProcess function by the program that started the application. An application should call
ShowWindow with this flag to set the initial show state of its main window.
SW_SHOWMAXIMIZED (3)
Activates the window and displays it as a maximized window.
SW_SHOWMINIMIZED (2)
Activates the window and displays it as a minimized window.
SW_SHOWMINNOACTIVE (7)
Displays the window as a minimized window. The active window remains active.
SW_SHOWNA (8)
Displays the window in its current state. The active window remains active.
SW_SHOWNOACTIVATE (4)
Displays a window in its most recent size and position. The active window remains active.
SW_SHOWNORMAL (1)
Activates and displays a window. If the window is minimized or maximized, Windows restores it to its
original size and position. An application should specify this flag when displaying the window for
the first time.

-Roger



Re: RUN Question by Beverly

Beverly
Mon Sep 24 20:32:09 PDT 2007

>> http://msdn2.microsoft.com/en-us/library/ms647732.aspx <<

Excellent... thanks,

Beverly Howard

Re: RUN Question by Beverly

Beverly
Tue Sep 25 09:45:46 PDT 2007

>>
oShell = Createobject("Shell.Application")

Then use Intellisense to check out the ShellExecute() method and its params.
<<

Think that's hitting on the starting point I need, but still not clear
and reluctant to execute the above without really understanding what I
am doing.

Backing up a couple of steps, since vfp is unresponsive to any
shellexecute() actions, I need to know how I install or activate it.

I _think_ the above is relevant, but don't know if the above goes back
to the basic starting point I need.

Does the above need to be executed each time time shellexecute is needed
or is there a way to get it as a default part of the environment... for
example, testing commands from the command window?

Thanks in advance,
Beverly Howard




Re: RUN Question by Dan

Dan
Tue Sep 25 12:15:40 PDT 2007

OK, back to basics.

ShellExecute() is a function in the Windows API. To use it in VFP you have
to somehow open the door and expose it.

You can use the FFC class I mentioned. If you look in there (it only has one
method <g>) you'll find a DECLARE command that tells VFP how to find it.

Another way to get it is to instantiate Shell.Application, which is also
external to VFP.

> oShell = Createobject("Shell.Application")

This creates a memory variable call oShell. The contents of that memory
variable is an object reference to the Shell.Application object. The memory
variable itself is subject to the same scoping rules as any other Foxpro
memory variable.

If you want an object to be globally available throughout your app, you
declare it in your top-level program, just as has always been the case. Or
you can create the object on the fly and release it when done. Doesn't
really matter unless you're in a tight loop.

In the command window, after creating the variable, type the variable name
and a dot:

oShell.

Intellisense will pop up a list of all known properties and methods of that
object. Highlight ShellExecute in the list and type ( (an open paren), and
VFP will give you a tooltip showing the parameters that method wants.

(All the docs for the WinAPI and Shell.Application are available on MSDN by
the way. I'm trying really hard not to say RTFM. <g>)

Dan

Beverly Howard [Ms-MVP/MobileDev] wrote:
> oShell = Createobject("Shell.Application")
>
> Then use Intellisense to check out the ShellExecute() method and its
> params. <<
>
> Think that's hitting on the starting point I need, but still not clear
> and reluctant to execute the above without really understanding what I
> am doing.
>
> Backing up a couple of steps, since vfp is unresponsive to any
> shellexecute() actions, I need to know how I install or activate it.
>
> I _think_ the above is relevant, but don't know if the above goes back
> to the basic starting point I need.
>
> Does the above need to be executed each time time shellexecute is
> needed or is there a way to get it as a default part of the environment...
> for example, testing commands from the command window?
>
> Thanks in advance,
> Beverly Howard



Re: RUN Question by Beverly

Beverly
Tue Sep 25 12:25:52 PDT 2007

>> OK, back to basics <<

That pretty much describes me in this environment ;-)

Thanks... now I think I have a starting point where I can learn as I crawl.

Beverly Howard


Re: RUN Question by Dan

Dan
Tue Sep 25 12:49:22 PDT 2007

Beverly Howard [Ms-MVP/MobileDev] wrote:
>>> OK, back to basics <<
>
> That pretty much describes me in this environment ;-)
>
> Thanks... now I think I have a starting point where I can learn as I
> crawl.

We've all been there, and anyone who tells you differently is fibbing. ;-)

Dan