Can a Windows GUI program written in Lazarus create a console and write to it at runtime?
问题 When writing a Lazarus program, you have the option of using $APPTYPE console or deselecting the Win32 GUI Application ( -WG option) in the Project Options . I noticed that without these options DebugLn and WriteLn raise exceptions. Is there a way to create a console even if the program is not compiled above mentioned options and output to it with DebugLn and WriteLn afterwards? 回答1: In windows it is a little more tricky compared to Delphi. In Delphi all you need to do is to call AllocConsole