wxWidgets / wxWidgets

Cross-Platform C++ GUI Library
https://www.wxwidgets.org/
5.78k stars 1.7k forks source link

Dialog Boxes on Errors #21141

Closed wxtrac closed 2 years ago

wxtrac commented 19 years ago

Issue migrated from trac ticket # 1776

priority: normal

2004-07-28 13:32:04: comp3333 created the issue


wxWindows 2.4.2

The wxWindows framework does display unrequested error boxes on failures.

In my program, I have to check if another DDE server is already running because then that server will not notice the changes I made to his config file. So basically I just shut him down.

But every time the server is NOT running, I get an error box, which is an excellent example for bad programming style. The program simply should alert this failure to the caller only.

src/msw/dde.cpp:404 and following:

#################### wxConnectionBase wxDDEClient::MakeConnection(const wxString& WXUNUSED(host), const wxString& server, const wxString& topic) { HCONV hConv = DdeConnect(DDEIdInst, DDEAtomFromString(server), DDEAtomFromString(topic), (PCONVCONTEXT)NULL); if ( !hConv ) { DDELogError(wxString::Format(_("Failed to create connection to server '%s' on topic '%s'"), server.c_str(), topic.c_str())); } else { wxDDEConnection connection = (wxDDEConnection*) OnMakeConnection(); if (connection) { connection->m_hConv = (WXHCONV) hConv; connection->m_topicName = topic; connection->m_client = this; m_connections.Append(connection); return connection; } }

return (wxConnectionBase*) NULL;

} ####################

BTW, why is the DDE Stuff no longer documented ? It was documented in 2.2 and is no longer in 2.4.

wxtrac commented 19 years ago

2004-07-28 16:11:56: @vadz commented


Please note that using sentences like "which is an excellent example for bad programming style" won't earn you a lot of good will.

And you may also want to go to read wxLog overview in the manual.