我正在尝试从 VB 2010 中创建的表单执行使用 gcc 编译的 C exe。C 可执行文件具有 int main 函数 int main(argv[],argc)
我已经能够使用以下方法将参数传递给函数:
    myProcess.StartInfo.UseShellExecute = False
    myProcess.StartInfo.RedirectStandardOutput = True
    myProcess.StartInfo.WorkingDirectory = Directory.GetCurrentDirectory
    myProcess.StartInfo.FileName = "trial4.exe"
    myProcess.StartInfo.CreateNoWindow = True
    If SelectedFileNames_Path > "" Then
        filename_strings = Chr(34) + SelectedFileNames_Path + Chr(34)
        If LocalTimeSelectBtn.Checked = True Then
            SelectedTime = LocalTime
        ElseIf GMTTimeSelectBtn.Checked = True Then
            SelectedTime = GMTTime
        End If
        myProcess.StartInfo.Arguments = SelectedTime + " " + filename_strings + " "
        AddHandler myProcess.OutputDataReceived, AddressOf NetOutputDataHandler
        SelectedFolder.Items.Clear()
        myProcess.Start()
        myProcess.BeginOutputReadLine()
        myProcess.Close()
    Else
        MsgBox(" Please select a directory before generating the CSV files ")
    End If
当 Trial4.exe 使用参数执行时,有一个返回类型 (int) 表明程序是否成功运行。
我找不到任何方法可以从这个 VB 形式的 C 可执行文件中获取返回值。我正在使用 Visual Studio 2010。
任何帮助是极大的赞赏。
谢谢,