Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command line call in Visual Foxpro 6

Status
Not open for further replies.

Grahamjx

Programmer
Jun 13, 2011
3
US
I got these program lines from an earlier thread here to run a program call with command line following and it works for Windows XP - does anyone know the equivalent for calling in Windows 7 ?


DECLARE INTEGER WinExec IN kernel32 ;
STRING lpCmdLine ,;
INTEGER uCmdShow

lcProg2Run="command line call"

WinExec(lcProg2Run,0)
 
Wasn't WinExec() designed for 16-bit compatibility? If so, the function you need is probably CreateProcess().

However, it's much simpler to use ShellExecute(). That will let you execute any command line without any compatibility issues. Have you considered doing that?

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
However, it's much simpler to use ShellExecute()

Mike - I would agree, but what I see resulting from a Google search for ShellExecute Win7 implies that ShellExecute does not work in Win7. Or at least work like it used to work.

Maybe I am reading the search links wrong or not completely enough, but I wouldn't put it past M$ to do us wrong once again.

Grahamjx - Good Luck,
JRB-Bldr



 
Just tested on my 32-bit Win7 machine (using the example from Mike's article--much easier than coming up with one of my own) and it worked just fine.

Tamar
 
Thanks for the responses - this is my first time on the forum

I had sucess with ShellExecute() but only with a direct run, not with commnand line as well.

If TamarGranor managed to make it work I'll try again, if not '
I'll also try the CreateProcess() approach

Thanks folks

Grahamjx
 
Thanks Dan

Sounds like I have a Windows 7 driver issue - I'll work on it after I get back from a short trip
 
Graham,

You wrote:

I had sucess with ShellExecute() but only with a direct run, not with commnand line as well.

The trick is to put the command-line parameters in the fourth parameter to ShellExecute() - with the name of the executable program or command in the third.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top