1

Recently, i've got interested in making a front-end for command-line program. I guess there's two way to do it.

First one is just including source code and calling main proc with arguments (Of course, there should be some changes in source code). Second one, which is there's no source code and just program, is just executing program internally then reading the command line with APIs.

Though I well know about the first solution, i don't know what APIs is needed to do the second solution. I'm talking about the APIs that get a command-line string or something like that.

Kate Gregory
  • 18,808
  • 8
  • 56
  • 85
  • Have you heard about Qt? Its a GUI framework for c++ applications. I hope it will serve your need. You can then either make you main as some function in your Qt program and then run it. I think it won't be much trouble! – Ankit Dec 18 '11 at 12:22
  • You can find a solution to your issue here: http://stackoverflow.com/questions/8547999/createprocess-and-createpipe-to-execute-a-process-and-return-output-as-a-string – Mike Nakis Dec 18 '11 at 12:36
  • Thank you @MikeNakis. That's the answer i've wanted (especially [the MSDN link](http://msdn.microsoft.com/en-us/library/ms682499%28VS.85%29.aspx)). –  Dec 21 '11 at 04:18

2 Answers2

1

See this question for information on how to run an external application; basically, you need to call CreateProcess function. I'm not sure what you mean by "reading the command line", I suppose you mean reading the output of an executed program? As for capturing an external application's output, there's already another question asking for that, you will probably find this answer most helpful.

Community
  • 1
  • 1
codeling
  • 11,056
  • 4
  • 42
  • 71
0

here is a codeProject project that I have used and can handle command line arguments for you (in the setup you describe). If you are not happy with it, you can use the direct WinApi calls using CommandLineToArgvW. Enjoy!

OSH
  • 2,847
  • 3
  • 25
  • 46