Home Help Center

ICE Server support MFC project based dialog?

mrliuhuamrliuhua Member liu huaOrganization: chinastockProject: fund evaluation
can ice server program support mfc project based dialog ? i have developed a mfc project based dialog with ice, but ice has memory allocation error?
code is below:
void CQuoteSvrDlg::OnBnClickedStart()
// TODO: Add your control notification handler code here
int status = 0;
Ice::CommunicatorPtr ic;
try {
int argc;
//char* argv[] = {"0"};
ic = Ice::initialize();
Ice::ObjectAdapterPtr adapter
= ic->createObjectAdapterWithEndpoints(
"HelloAdapter", "default -h -p 10000");
Ice::ObjectPtr object = new HelloI;
} catch (const Ice::Exception & e) {
//cerr << e << endl;
status = 1;
} catch (const char * msg) {
//cerr << msg << endl;
status = 1;
if (ic) {
try {
} catch (const Ice::Exception & e) {
//cerr << e << endl;
status = 1;


  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff

    Yes, an MFC application can also be an Ice server. For an example, see the demo/Ice/MFC client and server from your Ice distribution.

    A memory allocation error is often caused by a library mismatch in your project: see this FAQ and make sure you correctly link with iceutild.lib and iced.lib when building your application in debug mode (and iceutil.lib and ice.lib for the release mode).

    Also, calling waitForShutdown() from OnBnClickedStart will cause the GUI thread to hang and it won't be able to dispatch further events. I suspect you shouldn't call it here but instead call it when your application terminates.

Sign In or Register to comment.