DDEConnect Method hanging

Posted on 2005-05-12
Last Modified: 2013-11-20

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?

Question by:StanChart
    LVL 12

    Accepted Solution

    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.

    LVL 86

    Expert Comment

    You could try 'DdeQueryConvInfo()' to check whether a DDE conversation is established.
    LVL 3

    Expert Comment

    Try using the Kill Statemment to shutdown the dde server before calling again

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
    Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
    This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now