This forum has been archived. Please start a new discussion on GitHub.

Display in graphical interfaces when using callback or IceStorm

My server get file form remote, and my client get state when the server getting files. I shoud use callback mechanism or IceStorm putting message from server to client. My ice like:

module Demo{

interface msgCallback{
void transferred(string message);

interface getFileStorm{
void bcstMessage(string message);

interface myComm{
bool getFile(string filename, msgCallback* cb);

In the client, my callback definition like:
class CallbackReceiverI : public msgCallback
void transferred(const string& message, const Ice::Current& cur)
TRACE("%s\n", message.c_str()); // OK
c_pDlg.strMsg = message; // a global pointer to a dialog
c_pDlg.UpdateData(FALSE); // fail

The subscribe side definition like:
class MyStormI : public getFileStorm{
virtual void bcstMessage(const string& message, const Ice::Current& cur)
TRACE("%s\n", message.c_str());
c_pDlg.strMsg = message;

The messages display in console OK, but fail in graphical interfaces. The error message in the attach files. How could this be? What can I do. Help me. Thank you.
err.bmp 354.4K


  • matthew
    matthew NL, Canada
    What does UpdateData do? Assuming that this calls directly on some GDI object, you must not do this. Callbacks in Ice come from a thread other than main, and therefore cannot update GUI objects. Instead, you should process this data in the main thread. You can look at a series of articles I wrote on this in "Integrating Ice with a GUI" in Connections issues 12, 13, 14 & 15 (, or the articles on the chat demo (, or finally in the MFC demo (demo/Ice/MFC) in the Ice distribution.