Hello, programmers. How can I implement (and can I) output the console Pascal application in Delphi? Those. when you press the button, the console opens and from there the Pascal code is already running.

    3 answers 3

    There are two options. Or write a console application initially - for this you need to shamanize with the settings of the project, or create a separate window and display text in it. Here is an example of the result obtained by the first path.

    • Thank you for the option. And about the window, no source there? I don’t want to rewrite the project already ... - VaLenOK007
    • Um ... In the simplest version - TForm, on her TEdit or similar component. And then just write the output function to this TEdit of your text. And wherever necessary, you call it. - gecube
    • Clear. It’s just that the multi-button menu is not convenient to write for each button, but since there are not many options, we’ll do so. - VaLenOK007
    • And what is the initial vision of how the program should work? - gecube
    • one
      And what prevents each individual menu function from being implemented as a separate console (real!) Program? And the count. interface - it will only launcher a specific program. This is the first. Second, you can create a console yourself. To do this, even the corresponding API in Windows is. An example of <a href= halcyon.com/~ast/dload/guicon.htm> is here </ a >, true for C ++, but I ’m in a position to see exactly which functions are used. And then see MSDN ... - gecube

    Everything is made much easier. Example: Create a regular window application, throw a button on the form, double click on it, write the following code in the handler:

    procedure TForm1.Button1Click(Sender: TObject); begin AllocConsole; // Выделяем консоль Writeln('Hello!'); // Работаем с консолью Readln; // Ждем нажатия энтер перед освобождением консоли FreeConsole; // Освобождаем консоль end; 

      Well, if so ...

      Then write your exe with a form and a bunch of buttons.

      Next to them, put your exe console program.

      In the handler of each button write

        ShellExecute(Handle, 'open','1.exe', nil, nil,SW_SHOWNORMAL); 
      • hmm, and this is an idea ... I will try it, maybe it will - VaLenOK007
      • If necessary, I can write a simple sample program. - SoftR
      • it is good to. If the source can not be strengthened, refer to the soap: vladislav91@yandex.ru - VaLenOK007
      • It turns out that the problem is solved in two minutes) Thank you for the help. - VaLenOK007