Running external programs

Running external programs

Post by Michael Todd Bubli » Fri, 22 Dec 1995 04:00:00



Hi,

Anyone know what the command is that would allow an external Windows program
to be executed from within Delphi?  Specifically, I need to access R&R SQL
runtime from a button.

Thanks a lot !!!

-Mike

 
 
 

Running external programs

Post by Boris Ingr » Sat, 23 Dec 1995 04:00:00




>Subject: Running external programs
>Date: 21 Dec 1995 13:59:40 GMT
>Hi,
>Anyone know what the command is that would allow an external Windows program
>to be executed from within Delphi?  Specifically, I need to access R&R SQL
>runtime from a button.
>Thanks a lot !!!
>-Mike

Try WinExec - look in the Windoze API help

HTH

Boris Ingram, Cyborg Software

http://www.pcb.co.za/users/borising/cyborg.htm

 
 
 

Running external programs

Post by Zareh DerGevorkia » Tue, 26 Dec 1995 04:00:00


Try the WinExec WinAPI call...  Here's an extract from the Delphi WinAPI
help file on WinExec function:

WinExec (3.0)     (WINPROCS unit)

function WinExec(CmdLine: PChar; CmdShow: Word): Word;

The WinExec function runs the specified application.

Parameter       Description

CmdLine Points to a null-terminated Windows character string that
contains the command line
(filename plus optional parameters) for the application to be run. If the
string does not
contain a path, Windows searches the directories in this order:

1       The current directory.

2       The Windows directory (the directory containing WIN.COM); the
GetWindowsDirectory function
retrieves the path of this directory.

3       The Windows system directory (the directory containing such
system files as GDI.EXE); the
GetSystemDirectory function retrieves the path of this directory.

4       The directory containing the executable file for the current
task; the GetModuleFileName function
retrieves the path of this directory.

5       The directories listed in the PATH environment variable.

6       The directories mapped in a network.

CmdShow Specifies how a Windows application window is to be shown. See
the description of
the ShowWindow function for a list of the acceptable values for the
CmdShow
parameter. For a non-Windows application, the program-information file
(PIF), if any, for
the application determines the window state.

Returns

The return value identifies the instance of the loaded module, if the
function is successful. Otherwise,
returns an error value less than 32.

Errors

The error value may be one of the following:

Value   Meaning

0       System was out of memory, executable file was corrupt, or
relocations were invalid.
2       File was not found.
3       Path was not found.
5       Attempt was made to dynamically link to a task, or there was a
sharing or network-protection
error.
6       Library required separate data segments for each task.
8       There was insufficient memory to start the application.
10      Windows version was incorrect.
11      Executable file was invalid. Either it was not a Windows
application or there was an error in
the .EXE image.
12      Application was designed for a different operating system.
13      Application was designed for MS-DOS 4.0.
14      Type of executable file was unknown.
15      Attempt was made to load a real-mode application (developed for
an earlier version of
Windows).
16      Attempt was made to load a second instance of an executable file
containing multiple data
segments that were not marked read-only.
19      Attempt was made to load a compressed executable file. The file
must be decompressed
before it can be loaded.
20      Dynamic-link library (DLL) file was invalid. One of the DLLs
required to run this application
was corrupt.
21      Application requires 32-bit extensions.

Comments

The LoadModule function provides an alternative method for running an
application.

... a little lengthy, but I hope this helps !

 
 
 

Running external programs

Post by Arro » Sat, 30 Dec 1995 04:00:00



Quote:Bublitz) writes:

>Hi,

>Anyone know what the command is that would allow an external Windows
program
>to be executed from within Delphi?  Specifically, I need to access R&R
SQL
>runtime from a button.

>Thanks a lot !!!

>-Mike

winexec('program.exe',ws_showNormal);

Thats it

Ben
Arrow

 
 
 

1. run external program

This may not work as expected, mostly. Any processes which
spawns threads which are not under the SQL Server Service
may not work reliably using xp_cmdShell. This is applicable
for any applications with a visible or interactive User
Interface. And hence the application may appear 'hanging'.
A better option would be to check out the sp_OA* procedures
so that out of process automation can be done.

--
- Anith

2. Help Retrieve Result From Store Procedure (SQL Server 2000)

3. running external programs

4. asp and excel

5. Running External Program

6. How to remove corrupted MDAC installation with Component Checker ?

7. Running external program in VFP

8. 4js BDE

9. Running external programs on Progress 8.2

10. Running external programs fro Paradox

11. Running external programs with ShellAPI

12. Running external programs from within dBASE3+ application?

13. Trigger runs an external program?