GraphMetricCalculator Class showing SnapGraphMetrics.exe command prompt on top of window application

Jul 8, 2014 at 6:38 AM
we are using ver. 1.0.1.251 of NodeXL class library in our project (Window based application).
Every time when we try to calculate vertex centrality using below code, SnapGraphMetricCalculator.exe command prompt comes on the top of window.
 GraphMetricCalculatorBase.SetSnapGraphMetricCalculatorPath(strAppPath + "SnapGraphMetricCalculator.exe");
                        BrandesFastCentralityCalculator bfcc = new BrandesFastCentralityCalculator();
                        dictionaryCloseness = bfcc.CalculateGraphMetrics(nodeXLControl1.Graph);
We want to hide this command prompt by somehow make it work as hidden console application or not to run on the top of window.
Jul 8, 2014 at 5:01 PM
I don't know why that's happening. Here is the code that calls the SNAP executable:
protected Boolean
TryCallSnapGraphMetricCalculator
(
    SnapGraphMetrics eSnapGraphMetrics,
    String sArguments,
    out String sStandardError
)
{
    ProcessStartInfo oProcessStartInfo = new ProcessStartInfo(
        GetSnapGraphMetricCalculatorPath(eSnapGraphMetrics), sArguments);

    oProcessStartInfo.UseShellExecute = false;
    oProcessStartInfo.RedirectStandardError = true;
    oProcessStartInfo.CreateNoWindow = true;

    Process oProcess = new Process();
    oProcess.StartInfo = oProcessStartInfo;
    oProcess.Start();
    sStandardError = oProcess.StandardError.ReadToEnd();
    oProcess.WaitForExit();

    return (sStandardError.Length == 0);
}
Note that "CreateNoWindow" gets set to true, which prevents (or is supposed to prevent) a command window from opening. A command window does not open in our own Excel Template application, so this is working as expected for us.

Are you 100% certain that the window you're seeing is the SNAP executable window?

-- Tony
Jul 9, 2014 at 6:46 AM
Hi Tony,


We are sure that window is SNAP executable window. If you can provide me email id, i can even send you the screen shot of the application.
Jul 9, 2014 at 6:12 PM
No, I just needed to confirm the problem.

I don't know why this is occurring, and I can't spend too much time on it myself at the moment. Have you had a chance to research it? I found a few posts under a quick "createnowindow not working" search, but offhand the solutions didn't seem to fit. Can you see anything wrong with the code I posted earlier? The full code is here as of today:

http://nodexl.codeplex.com/SourceControl/latest#NodeXL/Algorithms/GraphMetricCalculators/GraphMetricCalculatorBase.cs

Thanks,
Tony