GetCommandDDE PowerScript function
Description
Obtains the command sent by the client application when your
application is a DDE server.
Syntax
|
1 |
<span>GetCommandDDE </span>( <span>string</span> ) |
|
Argument |
Description |
|---|---|
|
string |
A string variable in which GetCommandDDE will |
Return Values
Integer. Returns 1 if it succeeds and
-1 if an error occurs (such as the function was called in the wrong
context). If string is null, GetCommandDDE returns null.
Usage
When a DDE client application sends a command to your application,
the action triggers a RemoteExec event in the active window. In
that event’s script, you call GetCommandDDE to
find out what command has been sent. You decide how your application
will respond to the command.
To enable DDE server mode, use the function StartServerDDE,
in which you decide how your application will be known to other
applications.
Examples
This excerpt from a script for the RemoteExec event
checks to see if the action requested by the DDE client is Open
Next Sheet. If it is, the DDE server opens another instance of the
sheet DataSheet. If the requested action is Shut Down, the DDE server
shuts itself down. Otherwise, it lets the DDE client know the requested
action was invalid.
The variables ii_sheetnum and i_DataSheet[ ] are
instance variables for the window that responds to the DDE event:
|
1 |
integer ii_sheetnum |
|
1 |
DataSheet i_DataSheet[ ] |
This script that follows uses the local variable ls_Action to
store the command sent by the client application:
|
1 |
string ls_Action |
|
1 |
|
1 |
GetCommandDDE(ls_Action) |
|
1 |
IF ls_Action = "Open Next Sheet" THEN |
|
1 |
ii_sheetnum = ii_sheetnum + 1 |
|
1 |
OpenSheet(i_DataSheet[ii_sheetnum], w_frame_emp) |
|
1 |
ELSEIF ls_Action = "Shut Down" THEN |
|
1 |
HALT CLOSE |
|
1 |
ELSE |
|
1 |
RespondRemote(FALSE) |
|
1 |
END IF |