DdeExecuteΒΆ
DdeExecute executes a server macro.
-
bool = DdeExecute(hConv, ssCommand)
-
bool = DdeExecute(hConv, ssCommand, rsTimeout)
Return Value
If the function succeeds, the return value is TRUE (1); otherwise it is FALSE (0).
Parameters
-
hConv
hConv is the channel number (handle) which is used with other UniPlot DDE functions.
-
ssCommand
ssCommand is a command string, e.g.
DdeExecute(hConv, "[OPEN(\"c:/map.dif/")]")
.
-
rsTimeout
Specifies the maximum length of time, in milliseconds, that UniPlot will wait for a response from the server application in a synchronous transaction. This parameter should be 0xFFFFFFFF for asynchronous transactions. The default value is 5000.
Example
In the following example Excel is used to convert a file. A DIF file (Data Interchange Format) is converted and loaded into a UniPlot Editor.
// HKEY_CURRENT_USER\Software\Classes\CLSID\{F0C8D974-51B6-11D0-BE90-008048AA0191}\LocalServer32
def FindUniPlot()
{
RegConnect("HKEY_CURRENT_USER")
b = RegOpen("Software\\Classes\\UniPlot.Application\\CLSID");
s = RegGetValue("");
RegOpen("Software\\Classes\\CLSID\\" + s + "\\LocalServer32")
return RegGetValue("");
}
def FindApp(ssApp)
{
RegConnect("HKEY_LOCAL_MACHINE")
b = RegOpen("Software\\Classes\\" + ssApp + "\\CLSID");
s = RegGetValue("");
RegOpen("Software\\Classes\\CLSID\\" + s + "\\LocalServer32")
return RegGetValue("");
}
def test_DdeExecute()
{
s = FindApp("Excel.Application");
if (s == "") {
MessageBoxError("Excel not found");
return;
}
system(s, SW_HIDE, 0);
hConv = DdeInitiate("Excel", "System");
DdeExecute(hConv, "[OPEN(\"" + GetRootDirectory() + "samples\\map-data.xls\")]")
hconvTab = DdeInitiate("Excel", "map-data.xls");
ssData = DdeRequest(hconvTab, "z1s1:z16384s255");
ssData = strfindreplace(ssData, ",", ".");
DdeExecute(hConv, "[CLOSE()]");
DdeExecute(hConv, "[QUIT()]");
DdeTerminateAll();
hedit = EdCreate();
EdSetText(hedit, ssData);
}
test_DdeExecute();
See also
Overview DDE, system, DdeInitiate, DdeTerminate, DdeTerminateAll, DdePoke, DdeRequest
id-1484792