Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to call another windows program
Message
From
09/07/1998 05:07:24
 
 
To
08/07/1998 23:32:18
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00115573
Message ID:
00115609
Views:
9
>Other than using the RUN /N command to run a windows based program, how you can you call it and pass parameters (Command line) to it? The command line version of:
>
>PrgStr = + " " +
>RUN /N PrgStr
>
>This does not work as the RUN command will not accept a string variable to run with and with that you can't change the parameters that need to be passed. I have already tried DDE and its not a compatible program.
>
>Thanks
>
>Gary

Gary,

Try the WinExec() of the win32api. Here's the code that FOCUS.FLL uses :

FOCUSFNC FW_SYS_WinExec( XBASE_PARAMETERS )
/*---------------------------------------*/
{
_initparc(1);
_retl( WinExec( _parc(1),PCOUNT() < 2 ? SW_SHOWDEFAULT : _parni(2) ) > 31 );
_deinitparc(1);
FOCUSFNCRETURN();
}

You can also directly call the WinExec() function by DECLARing it like in :

DECLARE INTEGER WinExec IN win32API STRING cmd,INTEGER mode

? WinExec( "MY PROGRAM.EXE",10 )

If WinExec() returns a result bigger than 31, it means that it successfully executed your call.

0 = HIDE
1 = SHOWNORMAL
2 = SHOWMINIMIZED
3 = SHOWMAXIMIZED
4 = SHOWNOACTIVATE
9 = RESTORE
10= SHOWDEFAULT

Does it help ?

Pat
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform