Hi all...

I have a query here... Is it possible to open another software application in runtime? My situation here is that I have some .dat files which has the data points for plotting a 2-D graph. I have heard about Tecplot as a great graphics renderer especially for simulations of fluids flow (which is the data I had). Since Tecplot only requires .dat files as the input to generate graphs, I am thinking if I can easily create graphics by executing and running Tecplot (opening another new window) in my current Windows application (created in C#) during runtime, it will be very convenient and I do not have to research more into GDI+ in order to develop contour and pathlines to do the fluids flow simulation using the data from the .dat files.

Thanks for any advice rendered... Time is running out... Hope I can start drawing my graphics either using Tecplot or GDI+ from C# soon. Thanks.

Dani AI

Generated

Short answer: yes — launch Tecplot from the C# app at runtime. 's pointer to the Process API is correct and 's reminder about System.Diagnostics is relevant. The important practical details are full paths, quoting arguments (paths with spaces), the process working directory, and robust error handling so failures are diagnosable.

Example pattern (robust startup + basic checks):

using System;
using System.Diagnostics;
using System.IO;

string exePath = @"C:\Program Files\Tecplot\tecplot.exe";
string datPath = Path.GetFullPath(@"output\case1.dat");

if (!File.Exists(exePath) || !File.Exists(datPath))
    throw new FileNotFoundException("Executable or data file missing.");

var psi = new ProcessStartInfo {
    FileName = exePath,
    Arguments = "\"" + datPath + "\"",
    UseShellExecute = true,
    WindowStyle = ProcessWindowStyle.Normal,
    WorkingDirectory = Path.GetDirectoryName(datPath)
};

try {
    using (var proc = Process.Start(psi)) {
        // proc may be null on failure; call proc?.WaitForExit() if the app must finish first
    }
} catch (Exception ex) {
    // log Win32Exception / InvalidOperationException / etc. for diagnosis
}

Troubleshooting and tips: always call Path.GetFullPath and quote arguments if they contain spaces; set WorkingDirectory if Tecplot expects relative file references; choose UseShellExecute = false only when capturing stdout/stderr (GUI apps rarely use that); check ExitCode or call WaitForExit when batch output is required; catch Win32Exception and InvalidOperationException to surface common startup problems. If silent/headless image generation is needed, check Tecplot’s batch/macro automation in its docs and run with the appropriate options. For embedding plots instead of launching an external program, a .NET plotting library or custom GDI+ drawing is the alternative.

For the immediate deadline described by , writing the .dat and invoking Tecplot is usually the fastest path to visual results.

Recommended Answers

All 4 Replies

Seems like i am your personal tutor huh? :p Anyway yes. System.Diagnostics.Process. There are a number of ways to get it to go. But in your case pass it the tecplot.exe path and the dat filename as a parameter (or it may need the dat file itself - i dont know about tecplot so wouldnt know) and tell it to start....

ProcessStartInfo myProcessStartInfo = new ProcessInfo(tecplot.exe path); //assuming you have the "using" statement
myProcessStartInfo.Arguments = datfilename;
Process.Start(myProcessStartInfo);

Yea, you will need the...I no he said it. But just to back it up :).

using System.Diagnostics;

In order to use the above code.

Ahahahaha yea f1fan, I would employ u as a personal tutor if I could :P

Thanks for all the advice! Thanks to tayspen too! :)

hahaha you couldnt afford my rates :p

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.