Delphi - Hide console window

Possible duplicate:
Profile and Memory Analysis Tools for Delphi
How to hide the console window?

I repeat this to make it more understandable. So here is my console application:

enter image description here

This opens the socket to 127.0.0.1:81, when the console application is visible, it works fine, now how can I work normally as a console, but make the console invisible?

I am using Delphi 2007 (7).

Thanks.

+4
source share
1 answer

You can use ShowWindow and GetConsoleWindow WinAPi.

Try this sample

 {$APPTYPE CONSOLE} uses Windows, SysUtils; function GetConsoleWindow: HWND; stdcall; external kernel32; begin try Writeln('Press enter to hide console the window'); Readln; //hide the console window ShowWindow(GetConsoleWindow, SW_HIDE); //do something Sleep(5000); Writeln('Press enter to exit'); //show the console window ShowWindow(GetConsoleWindow, SW_SHOW); Readln; except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; end. 
+7
source

Source: https://habr.com/ru/post/1441893/


All Articles