How can I get data from a Dynamic Data Exchange (DDE) server and display it in a Web page? On a Visual Basic form, I can use a text box and use Network Dynamic Data Exchange (NetDDE) with the link topic \K_ddeNDDE$|icomwdrv-LCNS_Link$, and my link item is T4:0,L1,C1. The data is automatically linked and displayed in the text box. This approach also works with a Visual Basic ActiveX document, which is then hosted by Internet Explorer 4.0. How can I accomplish the same thing in HTML or VBscript on a Web page? Is DDE supported by DHTML or VBScript? If not is there another way to accomplish the same thing?

You should be able to go through the IE 4 object as a DDE client just as you would with any other application, though I have to admit ignorance as to which specific topics IE4 publishes. However, I’m at a little bit of a loss to understand why you would want to go through DDE in the first place. You would get far better control if instead of using DDE you actually used the Internet Explorer Automation object itself, either in its form as a stand-alone application, or through the WebBrowser control.

In order to work with the Internet Explorer application, you will first need to create a reference to the SHDOCVW.DLL library. To do this, select Project–>References from the menu, then check Microsoft Internet Controls. Once you’ve done this, you can then dimension a reference to the IE object when you declare your variables:

Public IE as InternetExplorer

Or, if you want to catch an event within a given browser (and are using VB5 or above):

Public WithEvents IE as InternetExplorer 

Note that you while you’re declaring references, you may also want to declare one for MSHTML.TLB (Microsoft HTML Object Library), which gives you access to the entire IE Document Object Model. The following code, for example, will launch a new browser window, and send output to it, from VB:

Option ExplicitPublic WithEvents IE As SHDocVw.InternetExplorerPublic WithEvents Doc As HTMLDocumentPublic WithEvents Wnd As HTMLWindow2Private Sub Form_Load()    Set IE = New InternetExplorer    IE.Visible = True    IE.Navigate2 "file:///c|/windows/system/blank.htm"End SubPrivate Sub IE_DocumentComplete(ByVal pDisp As Object, URL AsVariant)    Dim Body As HTMLBody    Set Doc = IE.document    Set Wnd = Doc.parentWindow    Set Body = Doc.Body    Body.innerHTML = "


This is a test

" Wnd.alert ("This is a test")End Sub

The blank.htm document is just that: an HTML file that contains the barest minimum information for an HTML file and will be contained in your System directory (Windows NT users may have a different path). Once you browse to this document, the IE routine will raise an event flag on DocumentComplete, at which point you can assign variables to contain references to the document object, the document’s window, and the Body object of the document to produce any output that you need.

Note that the script languages don’t support the notion of DDE at all. You can get a reference to some of the OLE DDE type verbs that the control publishes by using the ExecWB method of IE. But for the most part any benefit that you get out of using DDE here is far outweighed by the sparseness of DDE versus the richness of the Document Object Model.

Hope that answers your question.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


The Latest

homes in the real estate industry

Exploring the Latest Tech Trends Impacting the Real Estate Industry

The real estate industry is changing thanks to the newest technological advancements. These new developments — from blockchain and AI to virtual reality and 3D printing — are poised to change how we buy and sell homes. Real estate brokers, buyers, sellers, wholesale real estate professionals, fix and flippers, and beyond may

man on floor with data

DevX Quick Guide to Data Ingestion

One of the biggest trends of the 21st century is the massive surge in internet usage. With major innovations such as smart technology, social media, and online shopping sites, the internet has become an essential part of everyday life for a large portion of the population. Due to this internet

payment via phone

7 Ways Technology Has Changed Traditional Payments

In today’s digital world, technology has changed how we make payments. From contactless cards to mobile wallets, it’s now easier to pay for goods and services without carrying cash or using a checkbook. This article will look at seven of the most significant ways technology has transformed traditional payment methods.