Results 1 to 4 of 4

Thread: Executing a console Application (.EXE File) from a VB 6 DLL

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2007
    Posts
    3

    Executing a console Application (.EXE File) from a VB 6 DLL

    Hello... I'm a complete newbie when it comes to VB 6 and i need to execute a Console Apoplication develped under Visual Studio Net using C#. I also need to wait for the execution to finish it and capture the return code of it in order to perform some other actions.

    Thanks a lot in advance

  2. #2
    Lively Member
    Join Date
    Jan 2007
    Location
    Belgium
    Posts
    104

    Re: Executing a console Application (.EXE File) from a VB 6 DLL

    Hello,

    We would like to help you , but can you be a Little more precise ?

    Thank you

    Best Regards,
    Didier.

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2007
    Posts
    3

    Re: Executing a console Application (.EXE File) from a VB 6 DLL

    Sure... I'm working in a CRM Platform named Pivotal. I wrotea couple of Console Applications in C# in Visual studio Net which are used to send formatted e-mails and print to disk crystal reports in several diferent formats, such as PDF, HTML, etc.

    In order to execute those console applications, pivotal needs a DLL registered in the windows Register with a particular key, so I made a new DLL in C# that does that exactly. This DLL only has a method which receives two strings as imput args, the path & file name of the console application i need to execute, and another string that has all the input arguments that that console needs. Is a generic Console Louncher. However, pivotal doesn't recognizes .NET DLLs, so I'm forced to create a VB6 console Launcher in order to execute those apps.

    I'll paste the code used in the C# console launcher, which only important things is that it has to wait until the end o the application execution before returning control to the OS.

    Code:
    using System;
    using System.Diagnostics;
    using System.ComponentModel;
    
    
    namespace ConsoleLauncherLib
    {
    	/// <summary>
    	/// Summary description for Class1.
    	/// </summary>
    	public class ConsoleLauncherLib
    	{
    		public ConsoleLauncherLib()
    		{
    			//
    			// TODO: Add constructor logic here
    			//
    		}
    		public static int execConsole(string ubicacion, string argumentos)
    		{
    			ProcessStartInfo _procesoInfo = new ProcessStartInfo(ubicacion,argumentos);
    			_procesoInfo.WindowStyle = ProcessWindowStyle.Hidden;
    			Process _proceso = Process.Start(_procesoInfo);
    			_proceso.WaitForExit();
    			int x = _proceso.ExitCode;
    			return x;
    		}
    	}
    }
    Thanks a lot for any help you can give me . I'm still trying to figure how to create a sub function for this

  4. #4

    Thread Starter
    New Member
    Join Date
    Jan 2007
    Posts
    3

    Re: Executing a console Application (.EXE File) from a VB 6 DLL

    So... doesn't anyone has a solution for this? I'm really in a tight spot here

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width