//Connect to DDE Server int connectDDE(char* ServiceName, char* TopicName) { //DDE requires special handles to Strings HSZ ServiceHSZ = DdeCreateStringHandle(Inst, ServiceName, 0); HSZ TopicHSZ = DdeCreateStringHandle(Inst, TopicName, 0); //Setup the connection between DDE client and server Conversation = DdeConnect(Inst, ServiceHSZ, TopicHSZ, NULL); DdeFreeStringHandle(Inst, ServiceHSZ); DdeFreeStringHandle(Inst, TopicHSZ); //If we recieve a handle then connection atempt was sucessul if (Conversation == NULL) { printf("Failed to Connect to DDE Server. Instance %d \n", Inst); DDEError(DdeGetLastError(Inst)); return 1; } else { #ifdef _ddedebug printf("Connected DDE\n"); #endif return 0; } }
JNIEXPORT jint JNICALL Java_de_walware_ecommons_io_win_DDEClient_ddeExecute( JNIEnv* env, jclass obj, jstring server, jstring topic, jstring command) { // Pull unicode strings from the java arguments const jchar *szServer = env->GetStringChars(server, 0); const jchar *szTopic = env->GetStringChars(topic, 0); const jchar *szCommand = env->GetStringChars(command, 0); // Init the DDEM Library DWORD idInst = 0; UINT iReturn = DdeInitialize(&idInst, (PFNCALLBACK) DdeCallback, APPCLASS_STANDARD | APPCMD_CLIENTONLY, 0 ); if (iReturn != DMLERR_NO_ERROR) { return 1; } // Connect to the DDE server HSZ hszServer = DdeCreateStringHandle(idInst, (WCHAR*) szServer, 0); HSZ hszTopic = DdeCreateStringHandle(idInst, (WCHAR*) szTopic, 0); HCONV hConv = DdeConnect(idInst, hszServer, hszTopic, NULL); // Free up some resources DdeFreeStringHandle(idInst, hszServer); env->ReleaseStringChars(server, szServer); DdeFreeStringHandle(idInst, hszTopic); env->ReleaseStringChars(topic, szTopic); // Make sure we're connected if (hConv == NULL) { DdeUninitialize(idInst); env->ReleaseStringChars(command, szCommand); return 2; } // Prepare data for transaction HDDEDATA hData = DdeCreateDataHandle(idInst, (LPBYTE) szCommand, (lstrlen((WCHAR*) szCommand) + 1) * sizeof(WCHAR), 0L, 0L, CF_UNICODETEXT, 0); env->ReleaseStringChars(command, szCommand); // Data is OK? if (hData == NULL) { DdeDisconnect(hConv); DdeUninitialize(idInst); return 3; } else { DdeClientTransaction((LPBYTE) hData, 0xFFFFFFFF, hConv, 0L, 0, XTYP_EXECUTE, TIMEOUT_ASYNC, NULL); } // Clean up DdeDisconnect(hConv); DdeUninitialize(idInst); return 0; }
CDDEConnection *CDDEClient::MakeConnection(const CString& /* host */, const CString& server_name, const CString& topic) { HSZ serviceName = DdeCreateStringHandle(DDEIdInst, (const char *)server_name, CP_WINANSI); HSZ topic_atom = DdeCreateStringHandle(DDEIdInst, (const char *)topic, CP_WINANSI); HCONV hConv = DdeConnect(DDEIdInst, serviceName, topic_atom, (PCONVCONTEXT)NULL); BOOL rt = DdeFreeStringHandle(DDEIdInst, serviceName); rt = DdeFreeStringHandle(DDEIdInst, topic_atom); if (hConv == NULL) return NULL; else { CDDEConnection *connection = OnMakeConnection(); if (connection) { connection->hConv = hConv; connection->topic_name = topic; connection->client = this; connections.AddTail(connection); // bDisconnected = true; return connection; } else return NULL; } }
void DDEService::_DoStop() { DdeNameService(m_dwDDEInst, 0L, 0L, DNS_UNREGISTER); if (m_hszProgman) { DdeFreeStringHandle(m_dwDDEInst, m_hszProgman); } if (m_hszGroups) { DdeFreeStringHandle(m_dwDDEInst, m_hszGroups); } if (m_hszFolders) { DdeFreeStringHandle(m_dwDDEInst, m_hszFolders); } if (m_hszAppProperties) { DdeFreeStringHandle(m_dwDDEInst, m_hszAppProperties); } DdeUninitialize(m_dwDDEInst); m_dwDDEInst = 0; CoUninitialize(); }
//----------------- // DDEIntegratorClient::~DDEIntegratorClient () { Disconnect(); if ( m_hszClientTopic ) DdeFreeStringHandle( gDDEClientId, m_hszClientTopic); m_hszClientTopic = NULL; if ( --gnClientCount == 0 ) { if ( ghszIntegratorService ) DdeFreeStringHandle( gDDEClientId, ghszIntegratorService); if ( ghszDebugMessageItem ) DdeFreeStringHandle( gDDEClientId, ghszDebugMessageItem); if ( ghszCommandItem ) DdeFreeStringHandle( gDDEClientId, ghszCommandItem); ghszIntegratorService = NULL; ghszDebugMessageItem = NULL; ghszCommandItem = NULL; if ( gDDEClientId ) DdeUninitialize(gDDEClientId); gDDEClientId = NULL; FreeProcInstance(glpIDEClientCallBack); glpIDEClientCallBack = NULL; } }
BOOL PEXPORT KppDDEPostAdvise(ATOMID idObjName, ATOMID idSlot) { OBJECTID idLink = FindLink(LinkName(idObjName, idSlot)); if (idLink) { ATOMID idTopic = Kpp_Get_SlotValue(OBJECT, idLink, Slot(idTopic)); HSZ hszTopic = AtomToHsz(idTopic); WORD wLen = KppGetAtomName(idObjName, return_buffer, RET_BUFFER_LEN); BOOL bRes = FALSE; HSZ hszItem; return_buffer[wLen++] = ':'; KppGetAtomName(idSlot, return_buffer + wLen, RET_BUFFER_LEN - wLen); hszItem = DdeCreateStringHandle(dwDDEInst, return_buffer, CP_WINANSI); if (hszTopic && hszItem) bRes = DdePostAdvise(dwDDEInst, hszTopic, hszItem); DdeFreeStringHandle(dwDDEInst, hszTopic); DdeFreeStringHandle(dwDDEInst, hszItem); return bRes; } return FALSE; }
word pl_open_dde_conversation(term_t service, term_t topic, term_t handle) { UINT i; HSZ Hservice, Htopic; if ( !dde_initialise() ) fail; if ( !get_hsz(service, &Hservice) || !get_hsz(topic, &Htopic) ) fail; /* Establish a connection and get a handle for it */ for (i=0; i < MAX_CONVERSATIONS; i++) /* Find an open slot */ { if (conv_handle[i] == (HCONV)NULL) break; } if (i == MAX_CONVERSATIONS) return PL_error(NULL, 0, NULL, ERR_RESOURCE, ATOM_max_dde_handles); if ( !(conv_handle[i] = DdeConnect(ddeInst, Hservice, Htopic, 0)) ) fail; DdeFreeStringHandle(ddeInst, Hservice); DdeFreeStringHandle(ddeInst, Htopic); return PL_unify_integer(handle, i); }
/* * IEDDEEnd */ void IEDDEEnd( void ) { int i; if( IdInst != 0 ) { DdeNameService( IdInst, (HSZ)NULL, (HSZ)NULL, DNS_UNREGISTER ); if( hDataItem != (HSZ)NULL ) { DdeFreeStringHandle( IdInst, hDataItem ); } if( hNameItem != (HSZ)NULL ) { DdeFreeStringHandle( IdInst, hNameItem ); } if( hFileItem != (HSZ)NULL ) { DdeFreeStringHandle( IdInst, hFileItem ); } for( i = 0; i < NUM_FORMATS; i++ ) { if( IEServices[i].hservice != (HSZ)NULL ) { DdeFreeStringHandle( IdInst, IEServices[i].hservice ); } if( IEServices[i].htopic != (HSZ)NULL ) { DdeFreeStringHandle( IdInst, IEServices[i].htopic ); } } DdeUninitialize( IdInst ); IdInst = 0; } if( DdeProc != (FARPROC)NULL ) { FreeProcInstance( DdeProc ); } } /* IEDDEEnd */
void DDE::Uninitialize() { if(g_serverName) DdeFreeStringHandle(g_pidInst, g_serverName); if(g_topic) DdeFreeStringHandle(g_pidInst, g_topic); // Shutdown DDE library DdeUninitialize(g_pidInst); }
//------DDE経由で取得------------------------------------ bool GetUrlByDDE( CString browser, CString &URL ) { bool ret = false; DWORD idInst = 0; UINT result = DdeInitialize( &idInst, DdeCallback, APPCMD_CLIENTONLY, 0L ); URL = _T(""); if ( result == DMLERR_NO_ERROR ) { LPSTR lpszApplication = browser.GetBuffer(0); LPSTR lpszTopic = "WWW_GetWindowInfo"; HSZ hszApplication = DdeCreateStringHandle( idInst, lpszApplication, CP_WINANSI ); HSZ hszTopic = DdeCreateStringHandle( idInst, lpszTopic, CP_WINANSI ); HSZ hszItem = DdeCreateStringHandle( idInst, "-1", CP_WINANSI ); if ( hszApplication && hszTopic && hszItem ) { HCONV hConv = DdeConnect(idInst, hszApplication, hszTopic, NULL); if ( hConv ) { HDDEDATA hData = DdeClientTransaction( NULL, 0, hConv, hszItem, CF_TEXT, XTYP_REQUEST, 1000, NULL ); if ( hData ) { char *pStart = (char *)DdeAccessData( hData, NULL ); if ( pStart ) { while ( *pStart++ != '"' ) ; if ( *pStart ) { char *pEnd = pStart; while ( *pEnd != '"' ) pEnd++; *pEnd = NUL; URL = pStart; ret = true; } } } DdeDisconnect( hConv ); } } if ( hszItem ) DdeFreeStringHandle( idInst, hszItem ); if ( hszTopic ) DdeFreeStringHandle( idInst, hszTopic ); if ( hszApplication ) DdeFreeStringHandle( idInst, hszApplication ); DdeUninitialize( idInst ); } return ( ret ); }
/* This should be during shutdown in WinMain */ void dde_uninitialise() { dde_enable_server(FALSE); DdeFreeStringHandle(idInst, hszService); DdeFreeStringHandle(idInst, hszTopic); DdeUninitialize(idInst); idInst = 0; }
static DWORD open_dde_conversation (LPCTSTR topic_name, const char *exename, const char *ddename, HCONV *convp) { DWORD session = 0; HCONV conversation = NULL; HSZ service, topic; UINT ret; int i, err = 0; ret = DdeInitialize(&session, (PFNCALLBACK) init_callback, APPCLASS_STANDARD | APPCMD_CLIENTONLY, 0); if (ret != DMLERR_NO_ERROR) { fprintf(stderr, "DDE: couldn't initialize session\n"); return 0; } service = DdeCreateStringHandle(session, ddename, CP_WINANSI); topic = DdeCreateStringHandle(session, topic_name, CP_WINANSI); if (!service || !topic) { fprintf(stderr, "DDE: string creation failed\n"); DdeUninitialize(session); return 0; } conversation = DdeConnect(session, service, topic, 0); if (conversation == NULL) { err = start_dde_server(exename); if (!err) { /* try to connect */ for (i=0; i<5 && !conversation; i++) { Sleep(CONNECT_DELAY); conversation = DdeConnect(session, service, topic, 0); } } if (conversation == NULL && !err) { fprintf(stderr, "DDE: couldn't contact server %s\n", ddename); err = 1; } } DdeFreeStringHandle(session, service); DdeFreeStringHandle(session, topic); if (err) { DdeUninitialize(session); session = 0; } else { *convp = conversation; } return session; }
void stop() { HandleOutput("hel2mos stop-\n"); if (hConvExtra) { DdeDisconnect ( hConvExtra ); } if (idInst) { DdeFreeStringHandle ( idInst, hszService ); DdeFreeStringHandle ( idInst, hszTopic ); DdeFreeStringHandle ( idInst, hszItem ); } }
void FAR ExitDDE (void) { if (ddeInstalled) { if (DdeNameService(ddeInstId,hService,0,DNS_UNREGISTER)) { DdeFreeStringHandle(ddeInstId,hService); DdeFreeStringHandle(ddeInstId,hTopic); DdeUninitialize(ddeInstId); } ddeInstalled=FALSE; } FreeProcInstance(ddeProc); }
BOOL ShutDownDDE ( void ) { extern DWORD idInst; if ( hConv != NULL) { DdeDisconnect ( hConv ); hConv = NULL; } DdeFreeStringHandle ( idInst, hSZService ); DdeFreeStringHandle ( idInst, hSZItem ); return (TRUE); }
bool XAP_Win32Slurp::disconnectSlurper(void) { if (m_hszServerName) DdeFreeStringHandle(m_idDdeServerInst,m_hszServerName); if (m_hszTopic) DdeFreeStringHandle(m_idDdeServerInst,m_hszTopic); DdeUninitialize(m_idDdeServerInst); m_idDdeServerInst = 0; m_bInitialized = false; return true; }
void ShutDownDDE ( void ) { extern HSZ hszService, hszItem, hszComplete, hszBatch, hszLoad; extern HCONV hConvApp; /* What does this do? -- Apparently Unused */ extern DWORD idInst; if ( hConvApp != NULL) { DdeDisconnect ( hConvApp ); hConvApp = NULL; } DdeNameService (idInst, hszService, (HSZ)NULL, DNS_UNREGISTER ); DdeFreeStringHandle ( idInst, hszService ); DdeFreeStringHandle ( idInst, hszCommand ); DdeFreeStringHandle ( idInst, hszResult ); }
/* * deleteStringData - delete a string handle from list */ static void deleteStringData( hsz_list *hlptr ) { DdeFreeStringHandle( DDEInstId, hlptr->hsz ); DeleteLLItem( (ss **)&hszHead, (ss **)&hszTail, (ss *)hlptr ); MemFree( hlptr ); } /* deleteStringData */
/*************************************************************************** Connect & Disconnect ****************************************************************************/ void DDEIntegratorClient::SetClientTopic ( char* pszTopicName ) { if ( m_hszClientTopic ) DdeFreeStringHandle( gDDEClientId, m_hszClientTopic); m_hszClientTopic = DdeCreateStringHandle( gDDEClientId, (LPSTR)pszTopicName, CP_WINANSI ); }
void DDEPoke(DWORD idInst, HCONV hConv, char* szItem, char* szData) { HSZ hszItem = DdeCreateStringHandle(idInst, szItem, 0); DdeClientTransaction((LPBYTE)szData, (DWORD)(lstrlen(szData)+1), hConv, hszItem, CF_TEXT, XTYP_POKE, 3000, NULL); DdeFreeStringHandle(idInst, hszItem); }
void WREDDEEnd( void ) { int i; if( IdInst != 0 ) { DdeNameService( IdInst, (HSZ)NULL, (HSZ)NULL, DNS_UNREGISTER ); for( i = 0; i < NUM_TOPICS; i++ ) { if( Topics[i].htopic != (HSZ)NULL ) { DdeFreeStringHandle( IdInst, Topics[i].htopic ); } } for( i = 0; i < NUM_SERVERS; i++ ) { if( EditServers[i].htopic != (HSZ)NULL ) { DdeFreeStringHandle( IdInst, EditServers[i].htopic ); } if( EditServers[i].hservice != (HSZ)NULL ) { DdeFreeStringHandle( IdInst, EditServers[i].hservice ); } } if( hDialogDump != (HSZ)NULL ) { DdeFreeStringHandle( IdInst, hDialogDump ); } if( hImageDump != (HSZ)NULL ) { DdeFreeStringHandle( IdInst, hImageDump ); } if( hFileItem != (HSZ)NULL ) { DdeFreeStringHandle( IdInst, hFileItem ); } if( hIs32BitItem != (HSZ)NULL ) { DdeFreeStringHandle( IdInst, hIs32BitItem ); } if( hDataItem != (HSZ)NULL ) { DdeFreeStringHandle( IdInst, hDataItem ); } if( hNameItem != (HSZ)NULL ) { DdeFreeStringHandle( IdInst, hNameItem ); } if( hServiceName != (HSZ)NULL ) { DdeFreeStringHandle( IdInst, hServiceName ); } DdeUninitialize( IdInst ); } if( DdeProc != (FARPROC)NULL ) { FreeProcInstance( DdeProc ); } }
/* * IEDDEDumpConversation */ BOOL IEDDEDumpConversation( HINSTANCE inst ) { HCONV hconv; HSZ hservice; HSZ htopic; BOOL ok; ok = IEDDEStart( inst ); if( ok ) { hservice = DdeCreateStringHandle( IdInst, WRE_SERVICE_NAME, CP_WINANSI ); ok = (hservice != (HSZ)NULL); } if( ok ) { htopic = DdeCreateStringHandle( IdInst, WRE_IMAGE_DUMP, CP_WINANSI ); ok = (htopic != (HSZ)NULL); } if( ok ) { // We expect the server to reject this connect attempt. // If it doesn't, then we terminate the conversation. hconv = DdeConnect( IdInst, hservice, htopic, (LPVOID)NULL ); if( hconv != (HCONV)NULL ) { DdeDisconnect( hconv ); } } if( hservice != (HSZ)NULL ) { DdeFreeStringHandle( IdInst, hservice ); } if( htopic != (HSZ)NULL ) { DdeFreeStringHandle( IdInst, htopic ); } IEDDEEnd(); if( !ok ) { IEDisplayErrorMsg( WIE_DDEINITTITLE, WIE_DDETERMINATIONMSG, MB_OK | MB_ICONINFORMATION ); } return( ok ); } /* IEDDEDumpConversation */
BOOL StartUpDDE ( HWND hWnd ) { extern FARPROC lpDDEProc; extern HSZ hSZService; extern HSZ hSZItem; extern DWORD idInst; extern HCONV hConv; HMENU hMenu = GetMenu ( hWnd ); BOOL RtnValue = TRUE; UINT Flags = ( MF_BYCOMMAND | MF_ENABLED ); /*--------------------------------+ | Setup Client Editor Application | +--------------------------------*/ lpDDEProc = (FARPROC) DDECallBack; if ( DdeInitialize ((LPDWORD) &idInst, (PFNCALLBACK)lpDDEProc, APPCMD_CLIENTONLY,0L) ) { Flags = ( MF_BYCOMMAND | MF_GRAYED); RtnValue = FALSE; MessageBeep ( 0 ); MessageBox (NULL,"Can not Initialize DDEML", "DDEML ERROR", MB_ICONSTOP | MB_TASKMODAL ); } else { /*----------------------------+ | Check if CLIPS is available | +----------------------------*/ HSZ hSZTopic = DdeCreateStringHandle ( idInst, "LOAD", CP_WINANSI ); hSZItem = DdeCreateStringHandle ( idInst, "DDEData", CP_WINANSI ); hSZService = DdeCreateStringHandle ( idInst, "CLIPS", CP_WINANSI ); hConv = DdeConnect ( idInst, hSZService, hSZTopic, (PCONVCONTEXT)NULL); if ( hConv == NULL ) { Flags = ( MF_BYCOMMAND | MF_GRAYED); RtnValue = FALSE; } else { DdeDisconnect ( hConv ); } DdeFreeStringHandle ( idInst, hSZTopic ); } EnableMenuItem( hMenu, IDM_EDIT_COMPLETE, Flags); EnableMenuItem( hMenu, IDM_HELP_COMPLETE, Flags); EnableMenuItem( hMenu, IDM_BUFFER_LOAD, Flags); EnableMenuItem( hMenu, IDM_BUFFER_LBUF, Flags); EnableMenuItem( hMenu, IDM_BUFFER_BATCH, Flags); return ( RtnValue ); }
SleepyApi::Impl::~Impl() { if (m_conv) { DdeDisconnect(m_conv); m_conv=NULL; } if (m_appId) { DdeFreeStringHandle(m_appId,m_service); DdeFreeStringHandle(m_appId,m_topic); DdeFreeStringHandle(m_appId,m_paused); DdeUninitialize(m_appId); } assert(m_instance==this); m_instance=NULL; }
WEXPORT WServer::~WServer() { /***************************/ if( _server != NULL ) { if( DdeNameService( _procid, _service, 0, DNS_UNREGISTER ) ) { } DdeFreeStringHandle( _procid, _service ); DdeFreeStringHandle( _procid, _topic ); DdeUninitialize( _procid ); _procid = NULL; #if !defined(__NT__) FreeProcInstance( _procInst ); #endif _service = NULL; _topic = NULL; _server = NULL; } }
void DDEExecute(const WCHAR* server, const WCHAR* topic, const WCHAR* command) { unsigned long inst = 0; HSZ hszServer = NULL, hszTopic = NULL; HCONV hconv = NULL; HDDEDATA hddedata = NULL; #ifdef _WIN64 CrashIf(str::Len(command) >= (DWORD)-1); if (str::Len(command) >= (DWORD)-1) return; #endif UINT result = DdeInitialize(&inst, &DdeCallback, APPCMD_CLIENTONLY, 0); if (result != DMLERR_NO_ERROR) goto Exit; hszServer = DdeCreateStringHandle(inst, server, CP_WINNEUTRAL); if (!hszServer) goto Exit; hszTopic = DdeCreateStringHandle(inst, topic, CP_WINNEUTRAL); if (!hszTopic) goto Exit; hconv = DdeConnect(inst, hszServer, hszTopic, 0); if (!hconv) goto Exit; DWORD cbLen = ((DWORD)str::Len(command) + 1) * sizeof(WCHAR); hddedata = DdeCreateDataHandle(inst, (BYTE*)command, cbLen, 0, 0, CF_UNICODETEXT, 0); if (!hddedata) goto Exit; HDDEDATA answer = DdeClientTransaction((BYTE*)hddedata, (DWORD)-1, hconv, 0, 0, XTYP_EXECUTE, 10000, 0); if (answer) DdeFreeDataHandle(answer); Exit: if (hddedata) DdeFreeDataHandle(hddedata); if (hconv) DdeDisconnect(hconv); if (hszTopic) DdeFreeStringHandle(inst, hszTopic); if (hszServer) DdeFreeStringHandle(inst, hszServer); DdeUninitialize(inst); }
bool WdeDDEDumpConversation( HINSTANCE inst ) { HCONV hconv; HSZ hservice; HSZ htopic; bool ok; ok = WdeDDEStart( inst ); if( ok ) { hservice = DdeCreateStringHandle( IdInst, WRE_SERVICE_NAME, CP_WINANSI ); ok = (hservice != (HSZ)NULL); } if( ok ) { htopic = DdeCreateStringHandle( IdInst, WRE_DIALOG_DUMP, CP_WINANSI ); ok = (htopic != (HSZ)NULL); } if( ok ) { // We expect the server to reject this connect attempt. // If it doesn't, then we terminate the conversation. hconv = DdeConnect( IdInst, hservice, htopic, (LPVOID)NULL ); if( hconv != (HCONV)NULL ) { DdeDisconnect( hconv ); } } if( hservice != (HSZ)NULL ) { DdeFreeStringHandle( IdInst, hservice ); } if( htopic != (HSZ)NULL ) { DdeFreeStringHandle( IdInst, htopic ); } WdeDDEEnd(); if( !ok ) { WdeDisplayErrorMsg( WDE_DDEDEATHMSG ); } return( ok ); }
/************************************************************************* * ShellDDEInit (SHELL32.@) * * Registers the Shell DDE services with the system so that applications * can use them. * * PARAMS * bInit [I] TRUE to initialize the services, FALSE to uninitialize. * * RETURNS * Nothing. */ EXTERN_C void WINAPI ShellDDEInit(BOOL bInit) { TRACE("ShellDDEInit bInit = %s\n", bInit ? "TRUE" : "FALSE"); if (bInit && !bInitialized) { DdeInitializeW(&dwDDEInst, DdeCallback, CBF_FAIL_ADVISES | CBF_FAIL_POKES, 0); hszProgmanTopic = DdeCreateStringHandleW(dwDDEInst, L"Progman", CP_WINUNICODE); hszProgmanService = DdeCreateStringHandleW(dwDDEInst, L"Progman", CP_WINUNICODE); hszShell = DdeCreateStringHandleW(dwDDEInst, L"Shell", CP_WINUNICODE); hszAppProperties = DdeCreateStringHandleW(dwDDEInst, L"AppProperties", CP_WINUNICODE); hszFolders = DdeCreateStringHandleW(dwDDEInst, L"Folders", CP_WINUNICODE); if (hszProgmanTopic && hszProgmanService && hszShell && hszAppProperties && hszFolders && DdeNameService(dwDDEInst, hszFolders, 0, DNS_REGISTER) && DdeNameService(dwDDEInst, hszProgmanService, 0, DNS_REGISTER) && DdeNameService(dwDDEInst, hszShell, 0, DNS_REGISTER)) { bInitialized = TRUE; } } else if (!bInit && bInitialized) { /* unregister all services */ DdeNameService(dwDDEInst, 0, 0, DNS_UNREGISTER); if (hszFolders) DdeFreeStringHandle(dwDDEInst, hszFolders); if (hszAppProperties) DdeFreeStringHandle(dwDDEInst, hszAppProperties); if (hszShell) DdeFreeStringHandle(dwDDEInst, hszShell); if (hszProgmanService) DdeFreeStringHandle(dwDDEInst, hszProgmanService); if (hszProgmanTopic) DdeFreeStringHandle(dwDDEInst, hszProgmanTopic); DdeUninitialize(dwDDEInst); bInitialized = FALSE; } }
int IsEqualString (HSZ hsz,LPSTR lp) { HSZ h; int ret; h=DdeCreateStringHandle(ddeInstId,lp,CP_WINANSI); ret=(DdeCmpStringHandles(hsz,h)==0); DdeFreeStringHandle(ddeInstId,h); return ret; }
void WdeDDEEndConversation( void ) { if( WdeClientConv != (HCONV)NULL ) { DdeDisconnect( WdeClientConv ); WdeClientConv = (HCONV)NULL; } if( WdeServerConv != (HCONV)NULL ) { DdeDisconnect( WdeServerConv ); WdeServerConv = (HCONV)NULL; } if( hService != (HSZ)NULL ) { DdeFreeStringHandle( IdInst, hService ); hService = (HSZ)NULL; } if( hTopic != (HSZ)NULL ) { DdeFreeStringHandle( IdInst, hTopic ); hTopic = (HSZ)NULL; } }