Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 146359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:35:20+00:00 2026-05-11T08:35:20+00:00

Is it possible to spawn a synchronous process in VB6 (i.e. calling an external

  • 0

Is it possible to spawn a synchronous process in VB6 (i.e. calling an external .exe), wait for it to terminate, and grab the return value?

We have legacy code (in VB6 obviously) that we need to call a .NET application to perform some complicated tasks, and based on the .NET app’s return value, either proceed or fail. Is there a better way of doing such a thing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T08:35:20+00:00Added an answer on May 11, 2026 at 8:35 am

    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.

     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 = &H20&    Private Const INFINITE = -1&    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) & ':'         ChDir workdir          start.cb = Len(start)         start.wShowWindow = SW_SHOWMINNOACTIVE          Call CreateProcessA(0&, cmdline, 0&, 0&, 1&, NORMAL_PRIORITY_CLASS, 0&, 0&, start, proc)         Call WaitForSingleObject(proc.hProcess, INFINITE)         Call GetExitCodeProcess(proc.hProcess, ret)         Call CloseHandle(proc.hThread)         Call CloseHandle(proc.hProcess)         ExecCmd=ret    End Function 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 131k
  • Answers 131k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Try using Any() Dim orders = From o in db.Orders… May 12, 2026 at 6:18 am
  • Editorial Team
    Editorial Team added an answer You'll have to check out files from SVN repo to… May 12, 2026 at 6:18 am
  • Editorial Team
    Editorial Team added an answer Just use Type type = typeof(TheCurrentType); It should never be… May 12, 2026 at 6:18 am

Related Questions

I'm designing a networking framework which uses WSAEventSelect for asynchronous operations. I spawn one
I'm attempting to learn Clojure from the API and documentation available on the site.
Is it possible from within shoooes to spawn a separate thread which will read
My windows application hosts a Flex application via the IE ocx. I have a

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.