calling external .exe program from VB 
Author Message
 calling external .exe program from VB

Hi,

I'm writing an application which generates txt file which is an input file
for an external exe program. This external program (command line win32
application) then writes it's results into another txt file which my
application reads.
The problem is, I want my application to wait for external program to finish
before trying to read in results.
Please help. Thanx, Igor

PS
I tried using Shell function but in this case my program starts external
app. and moves on before this program gives any output.

--
http://www.*-*-*.com/



Tue, 26 Oct 2004 18:07:08 GMT  
 calling external .exe program from VB

Quote:

> The problem is, I want my application to wait for external program to
> finish before trying to read in results.

http://support.microsoft.com/default.aspx?scid=kb;EN-US;q129796

Eq.

--

Equinox Tetrachloride
www.cl4.org - www.insecurities.org



Tue, 26 Oct 2004 18:26:17 GMT  
 calling external .exe program from VB
You may want to take a look at the
CreateProcess&, WaitForSingleObject&, and the CloseHandle&
functions in the WIN32 API.

Cheers,
GL

Quote:

> Hi,

> I'm writing an application which generates txt file which is an input file
> for an external exe program. This external program (command line win32
> application) then writes it's results into another txt file which my
> application reads.
> The problem is, I want my application to wait for external program to finish
> before trying to read in results.
> Please help. Thanx, Igor

> PS
> I tried using Shell function but in this case my program starts external
> app. and moves on before this program gives any output.



Wed, 27 Oct 2004 03:33:05 GMT  
 calling external .exe program from VB


Quote:

> > The problem is, I want my application to wait for external program to
> > finish before trying to read in results.

> http://support.microsoft.com/default.aspx?scid=kb;EN-US;q129796

> Eq.

thanx.
igor
Quote:

> --

> Equinox Tetrachloride
> www.cl4.org - www.insecurities.org



Wed, 27 Oct 2004 17:12:38 GMT  
 calling external .exe program from VB

Quote:

> Hi,

> I'm writing an application which generates txt file which is an input file
> for an external exe program. This external program (command line win32
> application) then writes it's results into another txt file which my
> application reads.
> The problem is, I want my application to wait for external program to finish
> before trying to read in results.
> Please help. Thanx, Igor

> PS
> I tried using Shell function but in this case my program starts external
> app. and moves on before this program gives any output.

Try this code, just put in bas and you can call it just as you would
of called the shell fucn...

Const STILL_ACTIVE = &H103
Const PROC_QUERY_INFO = &H400

Declare Function SmOpenProcess Lib "kernel32" Alias "OpenProcess"
(ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal
dwProcessId As Long) As Long
Declare Function SmGetExitCodeProcess Lib "kernel32" Alias
"GetExitCodeProcess" (ByVal hProcess As Long, lpExitCode As Long) As
Long
Declare Function SmCloseHandle Lib "kernel32" Alias "CloseHandle"
(ByVal hObject As Long) As Long

Private lngDummy As Long

Global objMainSettings As clsMainSettings

Sub ShellModal(ByVal PathName As String, Optional ByVal WindowStyle As
Variant)

        Dim lngProcessId As Long
        Dim lnghProcess As Long
        Dim lngExitCode As Long

        lngProcessId = Shell(PathName, WindowStyle)
        lnghProcess = SmOpenProcess(PROC_QUERY_INFO, False,
lngProcessId)

        Do
            SmGetExitCodeProcess lnghProcess, lngExitCode
            lngDummy = DoEvents
        Loop While lngExitCode = STILL_ACTIVE

        SmCloseHandle lnghProcess

End Sub



Sun, 31 Oct 2004 22:52:53 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Newbie: Help with calling an external EXE program

2. Calling an external program (.exe) from within an ASP page

3. call external program from vb application

4. can VB call external programs?

5. Call another VB program(exe) in VB

6. Calling external exe

7. Help calling the external command - ping.exe

8. Calling an external EXE and hiding it.

9. Call External EXE

10. error 53 (file not found) with external DLLs called from COM or EXE

11. communicating with external program (.exe)

12. Running external programs (exe,bat)

 

 
Powered by phpBB® Forum Software