2

I´m trying to run my c++ Win32 program without a console. I just want to run the .exe file then Im going for the resultat via txt file that the program creates.

Im using VS2013 and I have search for the web for a way to do this but the only thing i can find is from VS2008 and dosn´t work for me. I need a hand guys. Best regards P.

2 Answers2

1

This is good enough for me! Thanks guys

#include<Windows.h>

int main()
{
Freeconsole();
// Program code goes here

}
0

With VS 2013 or Visual Studio from as early as I can remember there is a class called ProcessStartInfo you can pass parameters to. You could create an .NET application that runs your C++ console exe with ProcessWindowStyle.Hidden flags. Also use >> results.txt as the parameter. You could also use cmd.exe and pass the exe and it's arguments as the arguments property.

System.Diagnostics.ProcessStartInfo start =
      new System.Diagnostics.ProcessStartInfo();     
start.FileName = @"yourapp.exe";
start.Arguments = @">> results.txt";
start.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;

Not sure if this is what your wanting, but just a suggestion.

apollosoftware.org
  • 12,161
  • 4
  • 48
  • 69
  • yeah but the interfaceless c# app could call the C++ executable I was thinking. Not sure it'd work but... he already has VS 2013, so if he could run his already compiled win32 app as a parameter in place of "yourapp.exe", maybe it'd work? – apollosoftware.org May 17 '16 at 21:23
  • Is there a way in just regular console based application? – Petrus Lindblom May 17 '16 at 21:34