DDEConnect Method hanging


I use DDE to get updates from another application.  Sometimes, when my application closes, the DDE connection with the server is not closed properly.  In these cases, my application is still subscribed to receive updates.  If I try to connect again, my application hangs when using the method ::DdeConnect() . I presume it hangs because the server already thinks my application is registered to receive updates.  Is there anyway I can check to see whether my application is already registered on the DDE server?  If so, how can I terminate it?

Who is Participating?
With MFC applications, there can be more then one path an application can follow when being shutdown.  

It sounds as though your Dde transactions, connections, etc ( DdeDisconnect, DdeUnitialize, etc ) are not always being called, so you may need to verify that all closing 'paths' allow the Dde connection to be closed and any current transactions be abandoned before your application closes.  Look at DdeAbandonTransaction also.

There is a DMLERR_REENTRANCY  value returned from the DdeGetLastError function that indicates another conversion is already
taking place.


Please feel free to respond with any questions, I realize this posting is not as complete as it could be.

I think your best course of correction is to ensure that the Dde conversation is closed from your application.

You could try 'DdeQueryConvInfo()' to check whether a DDE conversation is established.
Try using the Kill Statemment to shutdown the dde server before calling again
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.