if(theApp.m_bInInitInstance) { return (HDDEDATA)DDE_FACK; }
CmdLineDdeCallBack(UINT type, UINT fmt,	HCONV hconv, HSZ hsz1, HSZ hsz2, HDDEDATA hData, DWORD dwData1,	DWORD dwData2){			//	Depending on the class of transaction, we return different data.	if(type & XCLASS_BOOL)	{		//	Must return (HDDEDATA)TRUE or (HDDEDATA)FALSE		switch(type)	{		case XTYP_CONNECT:	{			//	We are the server.			//	A client call the DdeConnect specifying a service and			//		topic name which we support.			HSZ& hszTopic = hsz1;			HSZ& hszService = hsz2;						//	Deny the connection if the service name is not the			//		one we are taking connections for.			if(hszService !=				CDDECMDWrapper::m_hsz[CDDECMDWrapper::m_ServiceName])	{				return((HDDEDATA)FALSE);			}						//	Now, the topic can be NULL, or it can be any one of our			//		topic names to be accepted.			if(hszTopic == NULL)	{				return((HDDEDATA)TRUE);			}						//	Go through all our topics, see if we match.			if(0 != CDDECMDWrapper::EnumTopic(hszTopic))	{				return((HDDEDATA)TRUE);			}						//	Topic not supported			return((HDDEDATA)FALSE);		}		default:			//	unknown			return((HDDEDATA)FALSE);		}				//	Break handled here		return((HDDEDATA)FALSE);	}	else if(type & XCLASS_DATA)	{		//	Must return DDE data handle, CBR_BLOCK, or NULL					return(NULL);	}	else if(type & XCLASS_FLAGS)	{		//	Must return DDE_FACK, DDE_BUSY, or DDE_FNOTPROCESSED		switch(type)	{		case XTYP_ADVDATA:	{			//	We are the client.			//	The server gave us a data handle.			break;		}		case XTYP_EXECUTE:	{			//	We are the server.			//	A client said XTYP_EXECUTE in DdeClientTransaction			HDDEDATA& hDataExecute = hData;			char *pData = (char *)DdeAccessData(hDataExecute, NULL);			char szCmd[_MAX_PATH+12];			strcpy ( szCmd, "[cmdline(\"" );			strcat ( szCmd, pData );			strcat ( szCmd, "\")]" );			BOOL bRetval = theApp.OnDDECommand(szCmd);						DdeUnaccessData(hDataExecute);			return((HDDEDATA) bRetval);		}		default:			//	unknown			return(DDE_FNOTPROCESSED);		}				//	Break handled here		return(DDE_FNOTPROCESSED);	}	else if(type & XCLASS_NOTIFICATION)	{		//	Must return NULL, as the return value is ignored		switch(type)	{		case XTYP_ADVSTOP:	{			//	We are the server			//	A client said XTYP_ADVSTOP in DdeClientTransaction			break;		}		case XTYP_CONNECT_CONFIRM:	{			//	We are the server.			//	We returned 1 to a XTYP_CONNECT transaction.						//	This callback is mainly to inform us of the conversation			//		handle that now exists, but we will actually be			//		creating an instance of an object to handle this			//		conversation from now on.			HSZ& hszTopic = hsz1;			HSZ& hszService = hsz2;						//	Create the object, correctly initialized so that			//		it understands the service, topic, and conversation			//		it is handling.			//	It will add itself to the conversation list.			CDDECMDWrapper *pObject = new CDDECMDWrapper(hszService, hszTopic,				hconv);			break;		}		case XTYP_DISCONNECT:	{			//	We are either client/server			//	The partner in the conversation called DdeDisconnect			//		causing both client/server to receive this.						//	Find out which conversation object we are dealing with.			CDDECMDWrapper *pWrapper = CDDECMDWrapper::GetConvObj(hconv);						//	Simply delete it.			//	The object takes care of removing itself from the list.			if(pWrapper != NULL)	{				delete pWrapper;			}			break;		}		case XTYP_ERROR:	{			//	We are either client/server			//	A serious error has occurred.			//	DDEML doesn't have any resources left to guarantee			//		good communication.			break;		}		case XTYP_REGISTER:	{			//	We are either client/server			//	A server application used DdeNameService to register			//		a new service name.			break;		}		case XTYP_UNREGISTER:	{			//	We are either client/server			//	A server applciation used DdeNameService to unregister			//		an old service name.			break;		}		case XTYP_XACT_COMPLETE:	{			//	We are the client			//	An asynchronous tranaction, sent when the client specified			//		the TIMEOUT_ASYNC flag in DdeClientTransaction has			//		concluded.			break;		}		default:			//	unknown			return(NULL);		}		return(NULL);	}	//	Unknown class type	return(NULL);}