Re: How can I hide the command line window?



how I can run this external program in the background with the command line window hidden.

Mark the external executable as a so-called "gui" program. If you
build it yourself, use the -mwindows option (if using GNU tools, i.e.
MinGW) or /subsystem:windows option (if using MS tools).

If you don't build the external executable yourself, you can still
just set the header fields that indicates the "subsystem" to say that
it is a "gui" executable. MS's editbin.exe for instance can do this.

Note that whether a Windows executable is marked as being "gui" or
"console" is just a field in its header. It has no effect on what the
executable can or cannot do (like whether it can have a GUI or not).

Are there any other function I can use to solve my problem

If you are specifically writing your program to run only on Windows,
you can use the Win32 StartProcess() instead of
g_spawn_command_line_sync() and pass the CREATE_NO_WINDOW flag in the
dwCreateionFlags parameter.

--tml



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]