launching a batch file from VB6 app 
Author Message
 launching a batch file from VB6 app

Hi, all
I'm trying to launch a batch file from my VB6 application. This batch
file in turn calls .exe file and sends two parameters
(MyExecFileName.exe "abc" "123" that's the line in the batch file).
When manually ran the batch file works .
I tried two different approaches:
1. to launch batch file using CreateProcess
'****************************************************
   strCmdLine = "C:\MyBatchFileName.bat"
   strArguments = " " & """abc""" & " " & """123"""
   udtStartupInfo.dwFlags = STARTF_USESHOWWINDOW
    udtStartupInfo.wShowWindow = SW_SHOWHIDE
    udtStartupInfo.cb = Len(udtStartupInfo)
    lngResult = CreateProcess(strCmdLine, strArguments, _
        0&, 0&, 1&, NORMAL_PRIORITY_CLASS, ByVal 0&, vbNullString, _
udtStartupInfo, udtProcInfo)
    lngResult = WaitForSingleObject(udtProcInfo.hProcess, INFINITE)
    lngResult = CloseHandle(udtProcInfo.hThread)
   lngResult = CloseHandle(udtProcInfo.hProcess)
'*******************************************************************
CreateProcess returns 1 but I don't get the end result.

2. to launch .exe file itself using the same CreateProcess
'************************************************************
    strCmdLine = "C:\MyExecFileName.exe"
    strArguments = " " & """abc""" & " " & """123"""
    udtStartupInfo.dwFlags = STARTF_USESHOWWINDOW
    udtStartupInfo.wShowWindow = SW_SHOWHIDE
    udtStartupInfo.cb = Len(udtStartupInfo)
    lngResult = CreateProcess(strCmdLine, strArguments, _
        0&, 0&, 1&, NORMAL_PRIORITY_CLASS, ByVal 0&, vbNullString, _
udtStartupInfo, udtProcInfo)
    lngResult = WaitForSingleObject(udtProcInfo.hProcess, INFINITE)
    lngResult = CloseHandle(udtProcInfo.hThread)
    lngResult = CloseHandle(udtProcInfo.hProcess)
'************************************************************
I'll get the same result successful returned value and no end result.

Any help would be greatly appreciated.

Alena



Sun, 24 Jul 2005 23:55:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Launching a batch file from a module?

2. Launching a batch file programetically

3. Passing arguments to a batch file launched from a VBscript

4. Logon Script - Launched from BATCH file.

5. Launch an app modally from VB6

6. How to launch a crystal report from a VB6 app

7. How do I launch another app from VB6?

8. Windows installer pops up briefly after launching app built in VB6

9. Run a batch file from VB app.

10. VB DOS: Start Batch file after unloading app?

11. Running a batch file from VB 6 app

12. Running a batch file from VB6

 

 
Powered by phpBB® Forum Software