Question Dde(dynamic Data Exhange)

RealHeavyDude

Well-Known Member
AFAIK, DDE is Windows solely and you can use it to talk to other Windows programs that support it. Some 20 years ago I wrote an ABL ( or 4GL as it was called back then ) procedure that talked to MS Word ( don't know which version it was back then ) via DDE in some Progress V8.2.

If my memory servers me right there were a lot of issues:
  • First and foremost, at least at that time, it was shaky
  • Secondly, the DDE recipient ( MS Word ) must have alread been launched upfront
  • And, there was no way to prevent the user from closing the DDE Server ( visible in the task bar at least ) in between
Therefore, back then, I opted to use OCX integration instead as it offered far more control about the application ( MS Word ).

IMHO of course, OCX is hardly relevant today - is DDE still relevant these days?

Heavy Regards, RealHeavyDude.
 
hmmm thanks...

So it means that DDE is not relevant now...i am just curious about this, anyway thanks guys.

Talking to other programs ha..hmm interesting.

thanks.
 

GregTomkins

Active Member
We probably haven't written any DDE-related code in 10 years, and we only ever really wrote one program using DDE.

BUT, it's one of our most popular and enduring features ever, and even today it probably runs thousands of times every day. Its more modern replacements aren't nearly as slick user-experience-wise (as is so often the case, am I right?)

Here is the essence of the code. It code basically turns any temp-table into Excel. It's convenient in that users don't need to screw around with CSV files or XML, etc., nor do we need to install any browser plug-ins or server-side Java libraries or whatever. They just click a button and Excel opens up with their ABL data in an Excel spreadsheet.

Code:
CREATE"Excel.Application":U h_excel_application NO-ERROR.
h_workbook = h_excel_application:Workbooks:Add().
h_worksheet = h_excel_application:Sheets:Item(1).
CREATEQUERY h_qh.
h_qh:SET-BUFFERS(p_th:DEFAULT-BUFFER-HANDLE).
h_qh:QUERY-PREPARE("FOR EACH ":U + p_th:NAME).
h_bh = h_qh:GET-BUFFER-HANDLE(1).
h_qh:QUERY-OPEN().
DO h_ct =1TO p_br:NUM-COLUMNS:
    h_tmp = GetExcelColumnLetter(h_ct)+"1":U.
    h_ch = p_br:GET-BROWSE-COLUMN(h_ct).
    h_worksheet:Range(h_tmp):Value=REPLACE(TRIM(h_ch:LABEL),"!":U," ":U).
    h_worksheet:Columns(GetExcelColumnLetter(h_ct)):ColumnWidth = h_ch:WIDTH-CHARS.
END.
h_qh:GET-FIRST().
h_row =1.
DO WHILE h_bh:AVAIL:
    h_row = h_row +1.
    fld_blk:
    DO h_ct =1TO h_bh:NUM-FIELDS:
        DO h_ct2 =1 TO NUM-ENTRIES(p_skip_list):
            h_skip =INT(ENTRY(h_ct2,p_skip_list))NO-ERROR.
            IF h_skip = h_ct
            THENNEXT fld_blk.
        END.
        h_bf = h_bh:BUFFER-FIELD(h_ct).
        h_tmp = GetExcelColumnLetter(h_ct)+STRING(h_row).
        IF h_bf:DATA-TYPE="CHARACTER":U OR h_bf:DATA-TYPE="LOGICAL":U
        THEN h_worksheet:Range(h_tmp):Value="'":U + h_bf:BUFFER-VALUENO-ERROR.
        ELSE h_worksheet:Range(h_tmp):Value= h_bf:BUFFER-VALUENO-ERROR.
    END.
    h_qh:GET-NEXT().
END.
 

RealHeavyDude

Well-Known Member
Greg, that is OLE automation NOT DDE. DDE is completely different to OLE automation. While I prefer OLE automation / OCX integrations over DDE, both of them are Visual Basic ( pre-.NET ) technologies from Microsoft. Therefore I prefer to integrate with the .NET objects - for example I like the .NET objects provided by SAP CrystalReports to integrate much better than their OCX stuff.

Heavy Regards, RealHeavyDude.
 
Top