I belive that in Win 98 and ME any call to the glib logging functions call the Win32 AllocConsole() routine. To get around this you have to call your own handlers for all log domains that your app uses (including all libraries you include that use the g_log() family of functions).
A big thank you to the fine folks at Gaim for this one... here's how they have accomplished the task...
#ifdef _WIN32
/* We don't want a console window.. */
/*
* Any calls to the glib logging functions, result in a call to AllocConsole().
* ME and 98 will in such cases produce a console window (2000 not), despite
* being built as a windows app rather than a console app. So we should either
* ignore messages by setting dummy log handlers, or redirect messages.
* This requires setting handlers for all domains (any lib which uses g_logging).
*/
g_log_set_handler (NULL, G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
(opt_gdebug ? gaim_log_handler : gaim_dummy_log_handler),
NULL); g_log_set_handler ("Gdk", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
(opt_gdebug ? gaim_log_handler : gaim_dummy_log_handler),
NULL);
g_log_set_handler ("Gtk", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
(opt_gdebug ? gaim_log_handler : gaim_dummy_log_handler),
NULL);
g_log_set_handler ("GLib", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
(opt_gdebug ? gaim_log_handler : gaim_dummy_log_handler),
NULL);
g_log_set_handler ("GModule", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
(opt_gdebug ? gaim_log_handler : gaim_dummy_log_handler),
NULL);
g_log_set_handler ("GLib-GObject", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
(opt_gdebug ? gaim_log_handler : gaim_dummy_log_handler),
NULL);
g_log_set_handler ("GThread", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
(opt_gdebug ? gaim_log_handler : gaim_dummy_log_handler),
NULL);
/* g_print also makes a call to AllocConsole(), therefore a handler needs to be
set here aswell */
if(!opt_debug)
g_set_print_handler( gaim_dummy_print );
#endif
Matteo Frigerio wrote:
Hello at all, i have a problem under WIN32 (gtk+-2.2.0). When i load some fonts the gtk open a console form write error like "unable to load font ....". I known this but i don't want that gtk open the console. There is a way to disable logging on console ?
Thanks,
drhammer
______________________________________________________________________ Yahoo! Mail: 6MB di spazio gratuito, 30MB per i tuoi allegati, l'antivirus, il filtro Anti-spam http://it.yahoo.com/mail_it/foot/?http://it.mail.yahoo.com/ _______________________________________________ gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
-- Seth Remington SaberLogic, LLC 661-B Weber Drive Wadsworth, Ohio 44281 Phone: (330)335-6442 Fax: (330)336-8559