I take it this issue only shows itself on windows platform ?
Make sure you have checked the win32GUI option in your projects options (config and target}.
But there are in-source compiler directives that influences that behaviour as well e.g.
APPTYPE (I have no idea which one overrides: the config and target switch or apptype).
And then you have your external execution of programs from within a lazarus project that /could/ open up a terminal window.