void Dde_Item::Advise ( HWND Server, HWND Client, BOOL Hot ) { if ( Hot ) { // Search for a matching entry in the hot link list. Return if found. for ( int i=0; i<sizeof(HotLinks)/sizeof(HotLinks[0]); i++ ) { if ( ( HotLinks[i][0] == Server ) AND ( HotLinks[i][1] == Client ) ) { Log ( "WARNING: Link already established." ) ; PDDESTRUCT Response = MakeDDEObject ( Client, PSZ(Name), DDE_FACK, DDEFMT_TEXT, 0, 0 ) ; WinDdePostMsg ( Client, Server, WM_DDE_ACK, Response, DDEPM_RETRY ) ; return ; } /* endif */ } /* endfor */ // Search for an empty entry in the hot link list. Use if not found. for ( i=0; i<sizeof(HotLinks)/sizeof(HotLinks[0]); i++ ) { if ( ( HotLinks[i][0] == 0 ) AND ( HotLinks[i][1] == 0 ) ) { HotLinks[i][0] = Server ; HotLinks[i][1] = Client ; PDDESTRUCT Response = MakeDDEObject ( Client, PSZ(Name), DDE_FACK, DDEFMT_TEXT, 0, 0 ) ; WinDdePostMsg ( Client, Server, WM_DDE_ACK, Response, DDEPM_RETRY ) ; return ; } /* endif */ } /* endfor */ Log ( " WARNING: Hot link table full." ) ; } else { // Search for a matching entry in the warm link list. Return if found. for ( int i=0; i<sizeof(WarmLinks)/sizeof(WarmLinks[0]); i++ ) { if ( ( WarmLinks[i][0] == Server ) AND ( WarmLinks[i][1] == Client ) ) { Log ( "WARNING: Link already established." ) ; PDDESTRUCT Response = MakeDDEObject ( Client, PSZ(Name), DDE_FACK, DDEFMT_TEXT, 0, 0 ) ; WinDdePostMsg ( Client, Server, WM_DDE_ACK, Response, DDEPM_RETRY ) ; return ; } /* endif */ } /* endfor */ // Search for an empty entry in the warm link list. Use if not found. for ( i=0; i<sizeof(WarmLinks)/sizeof(WarmLinks[0]); i++ ) { if ( ( WarmLinks[i][0] == 0 ) AND ( WarmLinks[i][1] == 0 ) ) { WarmLinks[i][0] = Server ; WarmLinks[i][1] = Client ; PDDESTRUCT Response = MakeDDEObject ( Client, PSZ(Name), DDE_FACK, DDEFMT_TEXT, 0, 0 ) ; WinDdePostMsg ( Client, Server, WM_DDE_ACK, Response, DDEPM_RETRY ) ; return ; } /* endif */ } /* endfor */ Log ( " WARNING: Warm link table full." ) ; } /* endif */ // Reply with an error. PDDESTRUCT Response = MakeDDEObject ( Client, PSZ(Name), DDE_NOTPROCESSED, DDEFMT_TEXT, 0, 0 ) ; WinDdePostMsg ( Client, Server, WM_DDE_ACK, Response, DDEPM_RETRY ) ; }
static char SendData( message *msg, char send_init ) /**************************************************/ { initiate_data *idata; goto_data *gdata; DDESTRUCT *dde; gdata = MemAlloc( sizeof( goto_data ) + strlen( msg->error ) ); if( gdata == NULL ) { return( FALSE ); } if( send_init ) { idata = MemAlloc( sizeof( initiate_data ) + strlen( CurrSession->help_library ) ); if( idata == NULL ) { MemFree( gdata ); return( FALSE ); } idata->errorcount = 1; idata->errors[0].errorline = msg->row; idata->errors[0].offset = msg->col; idata->errors[0].length = msg->len; idata->errors[0].magic = 0; idata->liblength = strlen( CurrSession->help_library ); strcpy( idata->libname, CurrSession->help_library ); dde = MakeDDEObject( CurrSession->hwnd, "Initialize", 0, DDEFMT_TEXT, idata, sizeof( initiate_data ) + idata->liblength ); WinDdePostMsg( CurrSession->hwnd, hwndDDE, WM_DDE_EXECUTE, dde, DDEPM_RETRY ); } gdata->errorline = msg->row; gdata->offset = msg->col; gdata->resourceid = msg->resourceid; gdata->magic = 0; gdata->textlength = strlen( msg->error ); strcpy( gdata->errortext, msg->error ); dde = MakeDDEObject( CurrSession->hwnd, "Goto", 0, DDEFMT_TEXT, gdata, sizeof( goto_data ) + gdata->textlength ); WinDdePostMsg( CurrSession->hwnd, hwndDDE, WM_DDE_EXECUTE, dde, DDEPM_RETRY ); if( send_init ) { MemFree( idata ); } MemFree( gdata ); return( TRUE ); }
void Dde_Item::BroadcastUpdate ( ) { // Send data complete to all hot links. for ( int i=0; i<sizeof(HotLinks)/sizeof(HotLinks[0]); i++ ) { if ( HotLinks[i][0] ) { PDDESTRUCT Message = MakeDDEObject ( HotLinks[i][1], PSZ(Name), 0, Format, Data, Size ) ; WinDdePostMsg ( HotLinks[i][1], HotLinks[i][0], WM_DDE_DATA, Message, DDEPM_RETRY ) ; } /* endif */ } /* endfor */ // Send advisory to all warm links. for ( i=0; i<sizeof(WarmLinks)/sizeof(WarmLinks[0]); i++ ) { if ( WarmLinks[i][0] ) { PDDESTRUCT Message = MakeDDEObject ( WarmLinks[i][1], PSZ(Name), DDE_FNODATA, Format, 0, 0 ) ; WinDdePostMsg ( WarmLinks[i][1], WarmLinks[i][0], WM_DDE_DATA, Message, DDEPM_RETRY ) ; } /* endif */ } /* endfor */ }
void Dde_Item::Unadvise ( HWND Server, HWND Client ) { // Cancel any links on this item for this Server/Client pair. Terminate ( Server, Client ) ; // Reply with an ACK. PDDESTRUCT Response = MakeDDEObject ( Client, PSZ(Name), DDE_FACK, DDEFMT_TEXT, 0, 0 ) ; WinDdePostMsg ( Client, Server, WM_DDE_ACK, Response, DDEPM_RETRY ) ; }
void Dde_Topic::Execute ( HWND Server, HWND Client, char *ItemName, int Format, PVOID Data, int Size ) { // Search for the item and ask it to reply. Dde_Item *Item = First ; while ( Item ) { if ( !strcmpi ( ItemName, Item->QueryName() ) ) { Item->Execute ( Server, Client, Format, Data, Size ) ; return ; } /* endif */ Item = Item->QueryNext() ; } /* endwhile */ // Reply with an error if the topic was not found. PDDESTRUCT Response = MakeDDEObject ( Client, PSZ(Name), DDE_NOTPROCESSED, DDEFMT_TEXT, 0, 0 ) ; WinDdePostMsg ( Client, Server, WM_DDE_ACK, Response, DDEPM_RETRY ) ; }
void Dde_Item::Execute ( HWND Server, HWND Client, int, PVOID, int ) { // Reply with an error, as we don't support this function. PDDESTRUCT Response = MakeDDEObject ( Client, PSZ(Name), DDE_NOTPROCESSED, DDEFMT_TEXT, 0, 0 ) ; WinDdePostMsg ( Client, Server, WM_DDE_ACK, Response, DDEPM_RETRY ) ; }
void Dde_Item::Request ( HWND Server, HWND Client ) { // Reply with the item data. PDDESTRUCT Response = MakeDDEObject ( Client, PSZ(Name), 0, Format, Data, Size ) ; WinDdePostMsg ( Client, Server, WM_DDE_DATA, Response, DDEPM_RETRY ) ; }