When a server receives the /Embedding command-line argument, it should not create a new default document. Instead, it should wait until the client sends either the StdOpenDocument command or the StdEditDocument command followed by the Native data and then instructs the server to show the window. The server can use the StdHostNames item to display the client's name in the window title.
The following pseudocode illustrates the chain of events for a server implementing OLE through DDE. The example shows two cases: one in which the server reuses a single instance for editing all objects (in MDI child windows), and another in which a new instance is used for each object. Applications that use a new instance for each object should reject requests to open or create a new document when they already have a document open.
MDI application:
case WM_DDE_INITIATE:
if class name == this class {
if (DocumentName == OLESystem || DocumentName == System)
WM_DDE_ACK
else if DocumentName == name of some open document
WM_DDE_ACK
}
Multiple-instance application:
case WM_DDE_INITIATE:
if class name == this class {
if (DocumentName == OLESystem || DocumentName == System) {
if no documents are open
WM_DDE_ACK
}
else if DocumentName == name of some open document
WM_DDE_ACK
}