There is a program (Windows, on VC ++, but I think it does not matter), which opens a window, interactively allows you to open a file with data, set calculation parameters, calculate, display the results. In short, the usual calculated application.

But sometimes there are a number of data files for which the calculation parameters are the same, and you just want to start the program with the keys in the batch file, let it count.

I see such options.

  1. To make the second program on the basis of the first, in principle, is easy. But then you need to constantly coordinate the source code, and this is fraught with errors, unnecessary work, etc. etc.

  2. Make a calculated console program, which is somehow secretly called when necessary calculations from the window. How to correctly call it in the background, so that it does not try to open the console?

  3. Try to allocate the calculated part in the DLL, which is loaded from the console and from the window program. Minus - I use wxWidgets and DialogBlocks, and I can’t figure out anything, as in the DialogBlocks project, in addition to doing exe , also dll , and I don’t want to keep two separate projects either.

Of course, ideally - so that the program on the transferred keys itself made the decision on how to start it - as a console or as a window, but I have no idea how to achieve this.

What do you think, what approach will be the best (simpler and more reliable) of all?

  • Add command line parsing and if the parameters are set - do not draw a GUI, for example. According to point one: add a subproject to the project of the studio and use in them common sorts. Problems of reconciliation will not be. - Vladimir Martyanov
  • @ Vladimir Martianov Well, as I understand it, the linker is already creating an application of one type or another ... Plus, wxWidgets does not have a main () function at all - that is, I should do the command line analysis in the windowed application (if someone had suggested how to bypass wxWidgets and make it, roughly speaking, turn on upon request, would be grateful). - Harry
  • I have Qt debug builds and a console window, so there is a fundamental possibility. Getting the command line - GetCommandLine from WinAPI. - Vladimir Martyanov
  • Yes, you can create such an application. In the case of wxWidgets, you simply do not need to create a window in the onInit method and it will not. And then, using AllocConsole, you open yourself a console. - KoVadim
  • @KoVadim Aha, I'll try, thanks for the advice. - Harry

0