Windows
has the ability to pass data across a network using a feature called "Network DDE".
This means that it is possible to have the WinWedge (or any
other DDE enabled application) running on one or more PCs
providing real time data to an application running on an
entirely different PC in the network.
Using Network DDE in Windows NT/2K/XP with WinWedge
To use Network DDE, you have to create a "Network DDE Share" on the workstation where WinWedge is running and then connect to the network DDE share from another workstation. Windows NT/2K/XP comes with a tool called DDEShare.EXE that you can use to create DDE shares.
To set up the network share with the DDEShare.EXE program in Windows NT/2K/XP, use the following Steps:
Run DDEShare.EXE on the workstation where WinWedge is running.
(Select "Start" and "Run" then enter the command "DDEShare.EXE" and click OK)
In the DDE Share program select Shares - DDE Shares.
In the DDE Shares window, click "Add a Share..."
For the Share Name, enter: WinWedge$
For the Application name under "Old Style" and "Static" enter: WinWedge
For the Topic under "Old Style" and "Static" enter: COM1 (or whatever COM port WinWedge is active on)
Leave the "New Style" Application name and Topic blank.
Click the "Permissions" button and set the "Type of Access" for the "Everyone" to "Full Access" and click OK in the Permissions window.
Click OK in the DDE Share Properties window to return to the DDE Shares window.
In the DDE Shares window, select the new DDE Share named WinWedge$ and click the "Trust Share" button.
In the Trusted Share Properties window, place a check mark next to the options: "Initiate to Application Enable" and "Cmd Show Override, with" then click the "Set" button and finally click the OK button to return to the DDE Shares window.
Click OK in the DDE Shares window and then close the main DDE Share program window.
To establish a DDE link to any of the DDE data items available in WinWedge on the remote workstation, you would use the DDE Application name:
\\computer name\NDDE$
(where "computer name" is the name of the workstation where WinWedge is running)
and you would use the DDE Topic: WinWedge$
For example, suppose that you wanted to establish a DDE link between a cell in an Excel spreadsheet and the data field "Field(1)" in WinWedge running in the other workstation, you could enter the following formula in the Excel spreadsheet cell:
=\\Computer Name\NDDE$|WinWedge$!'Field(1)'
(Change "Computer Name" in the above formula to the name of the workstation where WinWedge is running.) To issue DDE Commands to WinWedge across the network, you would use the same DDE Application name and DDE Topic as above. For example, suppose that you wanted to write a VBA subroutine in Excel that sent a DDE command to WinWedge running in another workstation on your network, you could use the following steps:
In any other workstation in your network, open Excel and select Tools - Macro - Visual Basic Editor. When the Visual Basic Editor window opens, select Insert - Module to create a new VBA module.
Enter the following code in the module:
Sub SendCommandToWedge()
On Error Resume Next
Application.DisplayAlerts = False
chan = DDEInitiate("\\computer name\NDDE$", "WinWedge$")
DDEExecute chan, "[BEEP]" ' send the BEEP command to WinWedge
DDETerminate chan
End Sub
Change the "computer name" in the DDEInitiate line above to the name of the computer that WinWedge is running in. For example, if the workstation where WinWedge is running is named "Bob", change the DDEInitiate line above to:
chan = DDEInitiate("\\Bob\NDDE$", "WinWedge$")
Close the Visual Basic Editor and return to Excel.
When you want to close WinWedge on the other workstation, simply run the subroutine named "SendCommandToWedge" in the Excel spreadsheet. (select Tools - Macro - Macros... and then click the macro named "SendCommandToWedge" and click the Run button)
If WinWedge is running in the other workstation, the SendCommandToWedge macro will cause it to beep the other workstation's speaker.
If you do not want to use Excel, you can also use the DDE Command Tester that comes with WinWedge on the other workstation to send the AppExit command to WinWedge from the other workstation.
When you run the DDE Command Tester program (LINKTEST.EXE), enter the following parameters:
For the "DDE Application Name" enter: \\computer name\NDDE$
(Change the "computer name" in the DDEInitiate line above to the name of the computer that WinWedge is running in.)
For the DDE Topic enter: WinWedge$
For the DDE Command enter: [BEEP]
Click the Execute command to cause WinWedge to beep on the other workstation.
Using Network DDE in Windows 9x
Note: Network DDE must
be enabled in Windows 95/98 by running the program NETDDE.EXE.
You may want to place the NETDDE program in your StartUp
folder so that it runs automatically when you start Windows
95/98.
The process of setting up a network DDE connection
is fairly simple and involves using the ClipBook application
found in the MAIN program group in Windows. The ClipBook
extends the concept of the Windows Clipboard across a network.
The ClipBook allows you to create "ClipBook Pages" that
can be "Shared" with other computers on a network.
Once you create and share a page on one computer, other computers
on the network can "connect" to that page. If the
page contains data from a DDE server (like the Wedge), then
you can set up DDE links to the data and the data will be
passed to any client application on the network just as if
the client were running in the same local PC as the server
application.
Suppose you have the Wedge running in one PC
and you want to link data from "Field(1)" in the
Wedge to a cell in an Excel spreadsheet running in another
PC on your network. The following steps outline the procedure:
Note: All versions of Excel prior to 5.0c have a bug that
causes Network DDE connections to fail. If you have an earlier
copy of Excel you can get an update from Microsoft for free
if you call their technical support department.
1. Load and activate the Wedge on the
first PC. When the Wedge window appears, place the cursor
in input data field "Field(1)" and select "Copy" from
the EDIT menu.
2. Open the ClipBook program in the
PC where the Wedge is running and select "Local ClipBook" from
the WINDOW menu and then select "Paste" from the
EDIT menu. In the dialog box that appears, type MyPage in
the text box labeled "Page Name" and make sure
that the check box labeled "Share Item Now" is
checked.
3. Open up the ClipBook program on the
second PC where Excel will be run and select "Connect..." from
the FILE menu. When the dialog box appears, enter the network
name of the PC where the Wedge is running and click the OK
button. (If you do not know the name of the computer, click
the "Browse" button and the ClipBook will display
a list of all computers in the Network). This will display
a new window that will contain all the "shared" items
in the ClipBook running on the other PC. You should see an
item in the window with the name "MyPage" and then
select "Copy" from the EDIT menu. This operation
takes the data from the ClipBook on the other PC and places
it in the local clipboard.
4. Open Excel and place the cursor in the cell that
you want to link the data to and select "Paste Special" from
Excel's EDIT menu. In the dialog box that appears, check
the option labeled "Paste Link" and then click
the OK button. If the link is successful, you will see the
data from Field(1) in the cell and you will also see the
formula for the link in the formula bar. Whenever new data
is received by the Wedge it will be updated in the spreadsheet
cell.
If you look at the formula that Excel returns
from the above Copy / Paste Link procedure, it will look
something like the following:
| |
=\\ComputerName\NDDE$|$MyPage.dde!Field(1)
|
The formula for a DDE link in Excel is expressed
using the DDE Application Name followed by a pipe character
(|), a DDE Topic followed by an exclamation mark and then
the DDE Item Name.
If you were to use the Copy / Paste Link method
of establishing a DDE link between the Wedge and Excel where
both programs were running on the same PC, the linked cell
in Excel would contain a formula similar to the following:
The difference between a local DDE connection
and a network DDE connection is that instead of using the
DDE Server's executable file name, the Network DDE Application
Name becomes two slashes followed by the name of the computer
running the DDE Server program followed by a single slash
and the word: NDDE$. The DDE Topic also changes to
a dollar sign followed by the "Page Name" that
was assigned in the ClipBook application followed by a period
and the word DDE. The DDE Item Name stays the same.
After you create a "Page Name" using
the ClipBook application and paste data from a DDE server
into the page, the page name and the DDE connection data
contained in it will continue to exist even after you close
the ClipBook application on both computers. You can even
shut down Windows on both computers and when you restart
you will be able to re-establish the DDE links using the
same Network DDE Application, Topic and Item Names.
In other words, after you set up a Network
DDE connection once, you do not need to go through the same
procedure in the ClipBook every time you want to re-establish
the link.
If you wanted to send a DDE command from Excel
to a copy of the Wedge running on a remote PC, all you need
to do is to change the DDE Application Name and DDE Topic
to the new Network DDE Application and Topic Names. For example
the following Excel macro could be used to send the "BEEP" command
to a Wedge on a remote PC. (We will assume that the name
of the remote PC is "Bob" and that a ClipBook page
was created on that PC using the name "MyPage" and
that the page contains a DDE data field from the Wedge.)
| |
Sub
BeepRemoteWedge()
chan
= DDEInitiate("\\BOB\NDDE$", "$MyPage.DDE")
DDEExecute chan, "[BEEP]"
DDETerminate chan
End
Sub
|
|