Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your first option should probably be to expose an interface to expose the .NET interfaces to COM and use that (it is much cleaner), but if for some reason you have to do it through a spawned process use this VB6 code.</p> <pre><code> Private Type STARTUPINFO cb As Long lpReserved As String lpDesktop As String lpTitle As String dwX As Long dwY As Long dwXSize As Long dwYSize As Long dwXCountChars As Long dwYCountChars As Long dwFillAttribute As Long dwFlags As Long wShowWindow As Integer cbReserved2 As Integer lpReserved2 As Long hStdInput As Long hStdOutput As Long hStdError As Long End Type Private Type PROCESS_INFORMATION hProcess As Long hThread As Long dwProcessID As Long dwThreadID As Long End Type Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long Private Declare Function CreateProcessA Lib "kernel32" (ByVal lpApplicationName As Long, ByVal lpCommandLine As String, ByVal lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As Long, lpStartupInfo As STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) As Long Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long Private Declare Function GetExitCodeProcess Lib "kernel32" (ByVal hProcess As Long, lpExitCode As Long) As Long Private Const NORMAL_PRIORITY_CLASS = &amp;H20&amp; Private Const INFINITE = -1&amp; Private Const SW_HIDE = 0 Private Const SW_SHOWMINNOACTIVE = 7 Public Function ExecCmd(cmdline As String, workdir As String) As Integer Dim proc As PROCESS_INFORMATION Dim start As STARTUPINFO Dim ret as Long ChDrive Left(workdir, 1) &amp; ":" ChDir workdir start.cb = Len(start) start.wShowWindow = SW_SHOWMINNOACTIVE Call CreateProcessA(0&amp;, cmdline, 0&amp;, 0&amp;, 1&amp;, NORMAL_PRIORITY_CLASS, 0&amp;, 0&amp;, start, proc) Call WaitForSingleObject(proc.hProcess, INFINITE) Call GetExitCodeProcess(proc.hProcess, ret) Call CloseHandle(proc.hThread) Call CloseHandle(proc.hProcess) ExecCmd=ret End Function </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload