DDE and HTML

DDE and HTML

Question:
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?

Answer:
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 = "

Test

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:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes

ransomware cyber attack

Why Is Ransomware Such a Major Threat?

One of the most significant cyber threats faced by modern organizations is a ransomware attack. Ransomware attacks have grown in both sophistication and frequency over the past few years, forcing