I have built my program with -mwindows option, indeed the console window disappeared. However new problem emerged. This program wasn't able to run successfully with parameters. Then I used CreateProcess() instead , as a restult, my problem was solved.
------------------ Original ------------------ From: "Tor Lillqvist"<t...@iki.fi>; Date: Sun, Jul 19, 2009 09:32 PM To: "Lizhao"<jinmu...@126.com>; Cc: "gtk-app-devel-list"<gtk-app-devel-list@gnome.org>; Subject: 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 _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list