Platform SDK: Interprocess Communications |
A DDE client application posts a WM_DDE_EXECUTE message to a DDE server application to send a string to the server to be processed as a series of commands. The server application is expected to post a WM_DDE_ACK message in response.
To post this message, call the PostMessage function with the following parameters.
PostMessage( (HWND) hWnd, // handle to destination window WM_DDE_EXECUTE, // message to send (WPARAM) wParam, // handle to client window (HWND) (LPARAM) lParam // command string (LPCTSTR) );
The command string is a null-terminated string consisting of one or more opcode strings enclosed in single brackets ([ ]). Each opcode string has the following syntax, where the parameters list is optional:
opcode parameters
The opcode is any application-defined single token. It cannot include spaces, commas, parentheses, brackets, or quotation marks.
The parameters list can contain any application-defined value or values. Multiple parameters are separated by commas, and the entire parameter list is enclosed in parentheses. Parameters cannot include commas or parentheses except inside a quoted string. If a bracket or parenthesis character is to appear in a quoted string, it need not be doubled, as was the case under the old rules.
The following are valid command strings:
[connect][download(query1,results.txt)][disconnect] [query("sales per employee for each district")] [open("sample.xlm")][run("r1c1")] [quote_case("This is a "" character")] [bracket_or_paren_case("()s or []s should be no problem.")]
Note that, under the old rules, parentheses and brackets had to be doubled, as follows:
[bracket_or_paren_case("(())s or [[]]s should be no problem.")]
Servers should be able to parse commands in either form.
Unicode execute strings should be used only when both the client and server window handles cause the IsWindowUnicode function to return TRUE.
The client application allocates the global memory object by calling the GlobalAlloc function.
When processing the WM_DDE_ACK message that the server posts in reply to a WM_DDE_EXECUTE message, the client application must delete the object returned by the WM_DDE_ACK message.
The server application posts the WM_DDE_ACK message to respond positively or negatively. The server should reuse the global memory object.
Unless specified otherwise by a sub-protocol, the server should not post the WM_DDE_ACK message until all the actions specified by the execute command string are completed. The one exception to this rule is when the string causes the server to terminate the conversation.
Windows NT/2000: Requires Windows NT 3.1 or later.
Windows 95/98: Requires Windows 95 or later.
Header: Declared in Dde.h; include Windows.h.
Dynamic Data Exchange Overview, Dynamic Data Exchange Messages, GlobalAlloc, IsWindowUnicode, PackDDElParam, PostMessage, ReuseDDElParam, SendMessage, UnpackDDElParam, WM_DDE_ACK