Sending messages between a Qt application and an MFC application

  • Hi,
    I have two applications one is MFC(and I only have the executable ,but know that it is sending messages when some buttons are pushed) and the other is done using Qt.The one in MFC using something like this to send messages:

    CString strDataToSend = _T( "Hello" );
    HWND hWndReceived;
    cpd.dwData = 0;
    cpd.cbData = strDataToSend.GetLength();
    cpd.lpData = (void*)strDataToSend.GetBuffer(cpd.cbData);
    SendMessage( hWndReceived, WM_COPYDATA, 0, (LPARAM) & cpd );


    I need to receive those messages in my Qt application and take some appropriate actions.
    Is there a way Qt makes this easy to implement?

  • What are you trying to do? If you want to communicate between applications you might need to look at some IPC(Inter process communication) methods. try this link "":

  • HWND hWndReceived must be a valid handle of an existing window object

    try to find the qt window with "FindWindow": ... you can use Spy++ to look at window class name to be found

    anyway if you have access to the code of both apps you should consider other way for IPC

  • Thanks guys,
    I found that sockets are an easy way to get this done quickly as the project is tight on time.

    Thanks again.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.