Possible Duplicate:
Profiler and Memory Analysis Tools for Delphi
How do I hide the console window?
I'm reposting this to make it more clear. So, here is my console application:
That opens a socket to 127.0.0.1:81, when the console application is visible it works fine, now how do I keep it working fine as a console but make the console invisible?
I am using Delphi 2007 (7).
Thanks.
You can use ShowWindow
and the GetConsoleWindow
WinAPi functions.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With