home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Computerworld 1996 March
/
Computerworld_1996-03_cd.bin
/
idg_cd3
/
aplikace
/
komunika
/
telixwin
/
tfw.5
/
DDE_DEMO.SLT
< prev
next >
Wrap
Text File
|
1995-07-28
|
4KB
|
110 lines
/****************************************************************/
/* */
/* Demo of how to use DDE (Dynamic Data Exchange) in your */
/* scripts. This sample links to a MS Word document. */
/* */
/* Copyright 1995 deltaComm Development, Inc. */
/* */
/****************************************************************/
#const BUFFSIZE 255
main()
{
int DDEConv,
x;
str Buff[BUFFSIZE],
Buff2[10];
// Connect to Word for Windows using the System topic
// so we can find out more info about what it provides.
DDEConv = DDEInitiate("WINWORD", "SYSTEM");
if (DDEConv > 0) { // DDE conversation established.
prints("Connected...");
prints("");
// SysItems returns a list of all items in the System topic
// Each item in the string is separated by a tab (ASCII 9)
// character. For our purposes, will just display the string.
prints("Items available in the SYSTEM topic are:");
if (DDERequest(DDEConv, "SysItems", Buff))
prints(buff);
else
prints("Could not retrieve items.");
prints("");
// Topics returns a list of available topics. Tab delimited
// in the same manner as the SysItems topic.
prints("Topics available in the server are:");
if (DDERequest(DDEConv, "Topics", Buff))
prints(buff);
else
prints("Could not retrieve topics.");
prints("");
// close the DDE conversation.
DDETerminate(DDEConv);
prints("DDE Connection closed.");
}
else // DDE conversation could not be established.
prints("Could not connect.");
prints("");
// Connect to Fax software and add an attachment to current fax
DDEConv = DDEInitiate("FAXMNG", "CONTROL");
if (DDEConv > 0) { // DDE conversation established.
prints("Connected...");
prints("");
DDEPoke(DDEConv, "SendFax", "attach(^"C:\TFW\SCRIPTS\EXAMPLE.SLT^")");
// close the DDE conversation.
prints("DDE Connection closed.");
}
else // DDE conversation could not be established.
prints("Could not connect.");
prints("");
// Start a conversation with Program Manager
DDEConv = DDEInitiate("PROGMAN", "PROGMAN");
if (DDEConv > 0) {
prints("Connected...");
// Create a new group in Program Manager
prints("Creating new group...");
DDEExecute(DDEConv, "[CreateGroup(^"SALT Scripts^")]");
// Make sure that the new group is open
prints("Making sure new group is visible...");
DDEExecute(DDEConv, "[ShowGroup(^"SALT Scripts^", 1)]");
// Add a program item to the new group. The file should exist or this
// may fail. Note the use of ^" below. Those are embedded "
// characters. The string that is sent to Program Manager looks like:
// [AddItem("C:\TFW\SCRIPTS\EXAMPLE.SLC","Example Script","C:\TFW\TELIX.EXE",0)]
// The first parameter is the application filename. Second is the title
// for Program Manager. Third is the icon filename. Fourth is which
// icon to use (first is 0).
prints("Adding example script.");
DDEExecute(DDEConv, "[AddItem(^"C:\TFW\SCRIPTS\EXAMPLE.SLC^",^"Example Script^",^"C:\TFW\TELIX.EXE^",0)]");
}
DDETerminateall();
prints("");
}