6.6.6 Standard Commands in DDE Execute Strings

The syntax for standard commands sent in execute strings is the same as for other DDE commands:

command(argument1,argument2, . . . )[command2(argument1,argument2, . . . )]

Commands without arguments do not require parentheses. String arguments must be enclosed in double quotes.

6.6.6.1 International Execute Commands

DDE execute strings are typically sent from a macro language in an external application and are typically localized. OLE execute commands, however, are sent by application programs for their own purposes, need not be localized, and must be commonly recognized.

The OLE standard execute commands should not be localized; the U.S. spelling and separator characters are used. Therefore, the following rules apply:

Client applications and the client library send standard execute commands in U.S. form.

The server library must receive the U.S. form for these commands.

Servers written directly to the DDE-level protocol should parse the U.S. form, if they have no additional commands.

Servers that support both OLE and localized DDE execute commands should first parse the string by using localized separators. If this fails, they should parse it again using the U.S. form and, if successful, should execute the command. Optionally, if the command is received in the U.S. form, the server can check that the command is one of the valid standard commands.

6.6.6.2 Required Commands

This section lists commands that must be supported by server applications.

The StdNewDocument, StdNewFromTemplate, StdEditDocument, and StdOpenDocument commands all make the document available for DDE conversations with the name DocumentName. They do not show any window associated with the document; the client must send the StdShowItem and StdDoVerbItem commands, or the StdDoVerbItem command alone to make the window visible. This enables the client to negotiate additional parameters with the server (for example, the StdTargetDevice item) without causing unnecessary repaints.

StdNewDocument(ClassName, DocumentName)

Creates a new, empty document of the given class, with the given name, but does not save it. The server should return an error value if the document name is already in use. When the client receives this error, it should generate another name and try again.

The server should not show the window until it receives a StdShowItem command. Waiting for the client to send the StdShowItem and StdDoVerbItem commands makes it possible for the client to negotiate additional parameters (for example, by using StdTargetDevice) without forcing the window to repaint.

StdNewFromTemplate(ClassName, DocumentName, TemplateName)

Creates a new document of the given class with the given document name, using the template with the given permanent name (that is, filename).

The server should not show the window until it receives a StdShowItem command. Waiting for the client to send a StdShowItem command makes it possible for the client to negotiate additional parameters (for example, by using StdTargetDevice) without forcing the window to repaint.

StdEditDocument(DocumentName)

Creates a document with the given name and prepares to accept data that is poked into it with WM_DDE_POKE. The server should return an error if the document name is already in use. When the client receives this error, it should generate another name and try again.

The server should not show the window until it receives a StdShowItem command. Waiting for the client to send a StdShowItem command makes it possible for the client to negotiate additional parameters (for example, by using StdTargetDevice) without forcing the window to repaint.

StdOpenDocument(DocumentName)

Sent to the System topic. This command opens an existing document with the given name.

The server should not show the window until it receives a StdShowItem command. Waiting for the client to send a StdShowItem command makes it possible for the client to negotiate additional parameters (for example, by using StdTargetDevice) without forcing the window to repaint.

StdCloseDocument(DocumentName)

Sent to the System topic. This command closes the window associated with the document. Following acknowledgment, the server terminates any conversations associated with the document. The server should not activate the window while closing it.

StdShowItem(DocumentName, ItemName [, fDoNotTakeFocus])

Sent to the System topic. This command makes the window containing the named document visible and scrolls to show the named item (if any). The optional third argument indicates whether the server should take the focus and bring itself to the front. This argument should be TRUE if the server should not take the focus; otherwise, it should be FALSE. The default value is FALSE.

StdExit

Shuts down the server application. This command should be used only by the client application that launched the server. This command is available in the System topic only.

StdExit is sent to shut down an application if an error occurs during the startup phase or if the client started the server for an invisible update. If servers have unsaved data opened by the user, they should ignore this command.

6.6.6.3 Variants on Required Commands

The following variants of the above commands may be sent to the document topic rather than the System topic. This allows a client that already has a conversation with the document to avoid opening an additional conversation with the system. The document name is omitted from these commands because it is implied by the conversation topic and because it may have been changed by the server. This kind of name change does not invalidate the conversation. The client should not be forced to keep track of the name change unnecessarily. However, the server must be able to use the conversation information to identify the document on which to operate.

StdCloseDocument

Sent to the document conversation. This command closes the document associated with the conversation without activating it. This command causes a WM_DDE_TERMINATE message to be posted by the server window following the acknowledgment.

StdDoVerbItem(ItemName, iVerb, fShow, fDoNotTakeFocus)

Sent to the document conversation. This command is similar to the StdShowItem command, except that it includes an integer indicating which of the registered operations to perform and a flag indicating whether to show the window. The server can ignore the fShow flag, if necessary.

StdShowItem(ItemName [, fDoNotTakeFocus])

Sent to the document conversation. This command shows the document window, scrolling if necessary to bring the item into view. If the item name is NULL, scrolling does not occur. The optional second argument indicates whether the server should take the focus and bring itself to the front. This argument should be TRUE if the server should not take the focus; otherwise, it should be FALSE. The default value is FALSE.