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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run an Access executable from a Foxpro program

Status
Not open for further replies.

AllCaz

Programmer
Dec 5, 2000
12
0
0
US
A client would like to be able to launch an Access program from a Foxpro program. Is there a way to launch the Access program as a separate task so that it doesn't suffer any performance hit from Foxpro overhead? Is RUN /N the way to go or is there an API call or something else that is better?
 
There are several ways to launch a program by API calls.
Just to give a few:
Code:
DECLARE INTEGER WinExec IN KERNEL32 STRING lpCmdLine, INTEGER uCmdShow

WinExec(<cCommand>, <nWindowstyle> )

An example of the above can be found in this forum, search for the topic &quot;!|RUN&quot;

Code:
DECLARE LONG ShellExecute IN &quot;shell32.dll&quot;;
	LONG hwnd ,;
	STRING lpOperation ,;
	STRING lpFile ,;
	STRING lpParameters , ;
	STRING lpDirectory ,;
	LONG nShowCmd

ShellExecute(<nHandle>, <cOperation>, <cFile>, <cParameters>, <cDirectory>, <nWindowStyle>)

Fe launching an URL:
Code:
ShellExecute(0, &quot;open&quot;, cUrl, &quot;&quot;, &quot;&quot;, 1)

And then we can use the windows scripting host:

Code:
oShell = CREATEOBJECT(&quot;WScript.Shell&quot;)
oShell.Run( <cFilename>, <nWindowState>, <optional: lWaitForTermination>)
To run Access directly:
Code:
oShell.Run(&quot;MSAccess&quot;, SW_SHOWNORMAL)

Window styles:
Code:
#DEFINE SW_HIDE         0   &amp;&amp; Window not shown! 
#DEFINE SW_SHOWNORMAL   1
#DEFINE SW_MINIZED      2
#DEFINE SW_MAXIMIZED    3


Diederik Vermeeren
verm1864@exact.nl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top