Ver Mensaje Individual
  #8 (permalink)  
Antiguo 13/10/2008, 01:21
Laufwerk
 
Fecha de Ingreso: marzo-2007
Mensajes: 538
Antigüedad: 17 años, 2 meses
Puntos: 0
Respuesta: VB 2005 - Ejecutar .exe

si, son parametros.

Al final encontre este codigo
Código:
    Private Sub btEnviar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btEnviar.Click
        Dim strArgumentos As String = "127.0.0.1"
        Dim strExe As String = "ping"


        'Console.WriteLine(Shell(My.Application.Info.DirectoryPath & "\drivers\wmplw.exe s 3 0 " & n & My.Application.Info.DirectoryPath & "\" & folderAscGen & My.Settings.nombreArchivo, AppWinStyle.MaximizedFocus, False, -1))
        'proceso.Start(My.Application.Info.DirectoryPath & "\drivers\wmplw.exe", " s 3 0 " & n & My.Application.Info.DirectoryPath & "\" & folderAscGen & My.Settings.nombreArchivo)

        'Armar el proceso a ejecutar
        Dim startInfo As ProcessStartInfo = New ProcessStartInfo(strExe, strArgumentos)

        'Para poder manupular la salida indicamos que no se ejecute el shell
        startInfo.UseShellExecute = False

        '(...)UseShellExecute debe ser true si se desea establecer ErrorDialog en true(...)
        startInfo.ErrorDialog = False

        'Sin ventana...
        startInfo.CreateNoWindow = True

        'Deseamos manipular la salida del proceso, para ello debemos establecer que se redirija la salida
        startInfo.RedirectStandardOutput = True

        Try
            Dim p As Diagnostics.Process = System.Diagnostics.Process.Start(startInfo)

            'Leemos la salida (objeto StreamReader)
            Dim sr As System.IO.StreamReader = p.StandardOutput
            Dim cadenaSalida As String = sr.ReadToEnd()
            sr.Close()

            'La visualizamos en el textbox. Un ejemplo basico ;)...
            My.Forms.FrmCaptura.txtbxCaptura.Text = cadenaSalida
            My.Forms.FrmCaptura.Show()
        Catch ex As Exception
            My.Forms.FrmCaptura.txtbxCaptura.Text = (ex.Message)
            My.Forms.FrmCaptura.Show()
        End Try
    End Sub