DDE in MFC


Click here to change the theme.

See Implementing DDE Using C++ Classes for a great article describing use of DDE. The article includes some very useful sample code. However the version of stddde.cpp (from the article) that I have seems to have a few problems. I fixed them but it is so long ago that I forget the details. I at least made some comments so the following is a portion of that file that shows the corrections and with the uncorrected lines as comments.

CDDEServer::CDDEServer()
{
m_bInitialized = FALSE;
// m_strServiceName = AfxGetAppName();	// Modified by Sam Hobbs
m_strServiceName.Empty();		// Modified by Sam Hobbs
m_dwDDEInstance = 0;
}

CDDEServer::~CDDEServer()
{
Shutdown();
pTheServer = NULL;			// Added by Sam Hobbs
}

Also, in the "CDDEServer::Shutdown()" function I added the following line:

m_dwDDEInstance = 0;			// Added by Sam Hobbs

I added that to the end of the "if (m_bInitialized)" block; that is, after the following line:

m_bInitialized = FALSE;