2

I am coding on a native app that uses CreateProcess to launch a GUI based WPF application. In the lpCommandLine parameter, I am also including the command line info along with the application name. Incidently the WPF application to launch also adds a newline to console window whenever any command line parameters are sent to it. Due to this, CreateProcess() is relaunching the application every time I close it. Any help how to solve this issue?

I also searched several links like the one below but nothing really helps to solve my issue. Can one executable be both a console and GUI application?`

Community
  • 1
  • 1
Farhat
  • 71
  • 2
  • "Can one executable be both a console and GUI application?" - A console application can have a GUI component; yes. – Jesper Juhl May 25 '16 at 17:58
  • 1
    @JesperJuhl: And a console application can open windows, but a console application and a GUI application are still different animals in Windows world! – Serge Ballesta May 25 '16 at 18:04
  • Welcome to Stack Overflow! Make sure you read the [How do I ask a good question](http://stackoverflow.com/help/how-to-ask) page. Specifically, we would be better able to help if you include some details, like: What console window are you referring to, and how is it created? Could you include any code relevant to your question? See also: [How to create a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve). – Marc.2377 May 25 '16 at 19:03
  • @Serge Ballesta Sure. But the basic answer to the question "Can one executable be both a console and GUI application?" Is still "Yes". – Jesper Juhl May 25 '16 at 19:18
  • The application I am trying to launch using CreateProcess() is from a different team. It is a GUI based WPF application & I need to send some command line information to it which I have included in lpCommandLine. Now this application internally writes to the console when it receives any commandline parameter. Now when I call CreateProcess() the application is launched. If I close it, it relaunches itself. So I am not able to close and exit from that application. Is there a way CreateProcess can gracefully deal with such applications? Or I need to tell the application team to do something? – Farhat May 26 '16 at 10:01
  • Hope I am able to explain the problem better. – Farhat May 26 '16 at 10:02

0 Answers0