Hello,
I'm using wxSingleInstanceChecker to ensure that only one instance of my application is running. It works fine, however sometimes I see a message stating "Deleted stale lock file 'home/.../AppName' ". I know that this message only appears when the app is terminated indirectly (e.g. by killing the process in the terminal, or in the IDE debugger). I understand that it doesn't affect the execution of the app, and is useful for debugging purposes, however it won't be understandable to the end-user. Is there a way to suppress this message, or avoid it altogether?
Regards,
Ksawery
wxSingleInstanceChecker message
Re: wxSingleInstanceChecker message
I'm not sure if it works here, but try wrapping the creation of the wxSingleInstanceChecker instance with wxLogNull:
https://docs.wxwidgets.org/trunk/classwx_log_null.html
https://docs.wxwidgets.org/trunk/classwx_log_null.html
Use the source, Luke!
Re: wxSingleInstanceChecker message
Thank you, it worked! I used the following code:
Two more things - i'm seeing the following message in the console:
Is this something to be concerned about? This message also pops up in the terminal, and might be confusing to the end-user. It only occurs when attempting to start the application, when one session is already running.
Secondly, can I change the title of an error window? For example, the following window:
Thank you very much for your help!
Ksawery
Code: Select all
{
wxLogNull logNo;
wxChecker = new wxSingleInstanceChecker(_T("PomiarWiazki"));
}
Code: Select all
Gtk-Message: 10:43:55.126: GtkDialog mapped without a transient parent. This is discouraged.
Secondly, can I change the title of an error window? For example, the following window:
Thank you very much for your help!
Ksawery
Re: wxSingleInstanceChecker message
Is this an internal error message from wxWidgets or is it something you open in your code? If you use wxMessageBox, there is an additonal parameter for the caption.Secondly, can I change the title of an error window? For example, the following window:
If it's an internal error message, it probably uses the application name set by wxApp::SetAppName()
Use the source, Luke!
Re: wxSingleInstanceChecker message
I'm using wxLogError() to display the message, after checking if another instance is already running:
Code: Select all
if (wxChecker->IsAnotherRunning())
{
wxLogError(_T("\nProces już istnieje!"));
delete wxChecker; // OnExit() won't be called if we return false
wxChecker = NULL;
return false;
}
Re: wxSingleInstanceChecker message
Using wxApp::SetAppName() helped set the title of the error window, thanks.
How about the GTK message, is there a way to suppress it or avoid it? It only pops up when displaying the error window.
Edit: I tried using wxMessageBox instead of wxLogError, and i'm still seeing the gtk message.
Regards,
Ksawery
How about the GTK message, is there a way to suppress it or avoid it? It only pops up when displaying the error window.
Edit: I tried using wxMessageBox instead of wxLogError, and i'm still seeing the gtk message.
Regards,
Ksawery
- evstevemd
- Part Of The Furniture
- Posts: 2409
- Joined: Wed Jan 28, 2009 11:57 am
- Location: United Republic of Tanzania
Re: wxSingleInstanceChecker message
Is it debug or release mode?Ksawery wrote: ↑Tue Sep 10, 2019 9:26 am Using wxApp::SetAppName() helped set the title of the error window, thanks.
How about the GTK message, is there a way to suppress it or avoid it? It only pops up when displaying the error window.
Edit: I tried using wxMessageBox instead of wxLogError, and i'm still seeing the gtk message.
Regards,
Ksawery
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?