DDE Functions in a 32-bit Environment

This chapter contains information for DDE functions, as used in a Windows 32-bit environment.

Personal Communications provides a 32-bit dynamic data exchange (DDE) interface that allows applications to exchange data. The exchange of data between two Windows applications can be thought of as a conversation between a client and a server. The client initiates DDE conversations. The server in turn responds to the client. Personal Communications is a DDE server for the open sessions that Personal Communications is managing. For more information about DDE, refer to Microsoft Windows Software Development Kit Guide to Programming.

Note:
If you use DDE functions with Visual Basic, see Using DDE Functions with a DDE Client Application.

Personal Communications also supports 16-bit DDE applications. See Appendix E. DDE Functions in a 16-Bit Environment.

Personal Communications DDE Data Items

Microsoft Windows DDE uses a three-level naming scheme to identify data items: application, topic, and item. Table 17 describes these levels.

Table 17. Naming Scheme for Data Items
Level Description Example
Application A Windows task or a particular task of an application. In this book, the application is Personal Communications. IBM327032
Topic A specific part of an application. SessionA
Item A data object that can be passed in a data exchange. An item is an application-defined data item that conforms to one of the Windows clipboard formats or to a private, application-defined, clipboard format. For more information regarding Windows clipboard formats, refer to Microsoft Windows Software Development Kit Guide to Programming. PS (presentation space)

Personal Communications supports IBM327032 and IBM525032 applications as Win32 DDE server.

You can use the following topics:

In DDE, atoms identify application names, topic names, and data items. Atoms represent a character string that is reduced to a unique integer value. The character string is added to an atom table, which can be referred to for the value of the string associated with an atom. Atoms are created with the GlobalAddAtom function call. Refer to Microsoft Windows Software Development Kit Guide to Programming for more information about how to create and use atoms.

Using System Topic Data Items

Applications that provide a DDE interface should also provide a special topic SYSTEM. This topic provides a context for items of information that might be of general interest to an application. The SYSTEM topic for Personal Communications contains these associated data items:

Item Function
Formats Returns the list of clipboard formats (numbers) that Personal Communications is capable of rendering.
Status Returns information about the status of each Personal Communications session.
SysCon Returns the level of Personal Communications support and other system related values.
SysItems Returns the list of data items that are available when connected to the Personal Communications system topic.
Topics Returns the list of Personal Communications topics that are available.

Using Session Topic Data Items

For each Session topic, the following data items are supported:

Item Function
CLOSE Retrieves the window close requests.
CONV Requests Code Conversion from ASCII to EBCDIC and EBCDIC to ASCII.
EPS Retrieves the session presentation space with additional data.
EPSCOND Retrieves the presentation space service condition.
FIELD Retrieves the field in the presentation space of the session.
KEYS Retrieves the keystrokes.
MOUSE Retrieves the mouse input.
OIA Retrieves the operator information area status line.
PS Retrieves the session presentation space.
PSCOND Retrieves the session advise condition.
SSTAT Retrieves the session status.
STRING Retrieves the ASCII string data.
TRIMRECT Retrieves the session presentation space within the current trim rectangle.

Using LU Topic Data Items (3270 Only)

For each LU topic, the following data items are supported:

Item Function
SF Retrieves the destination/origin structured field data.
SFCOND Retrieves the query reply data.

DDE Functions

Table 18 lists the DDE functions that are available for use with Personal Communications.

Table 18. DDE Functions Available for Personal Communications
Function 3270 5250 VT
Code Conversion Yes Yes Yes
Find Field Yes Yes Yes
Get Keystrokes Yes Yes Yes
Get Mouse Input Yes Yes Yes
Get Number of Close Requests Yes Yes Yes
Get Operator Information Area Yes Yes Yes
Get Partial Presentation Space Yes Yes Yes
Get Presentation Space Yes Yes Yes
Get Session Status Yes Yes Yes
Get System Configuration Yes Yes Yes
Get System Formats Yes Yes Yes
Get System Status Yes Yes Yes
Get System SysItems Yes Yes Yes
Get System Topics Yes Yes Yes
Get Trim Rectangle Yes Yes Yes
Initiate Session Conversation Yes Yes Yes
Initiate Structured Field Conversation Yes No No
Initiate System Conversation Yes Yes Yes
Put Data to Presentation Space Yes Yes Yes
Search for String Yes Yes Yes
Send Keystrokes Yes Yes Yes
Session Execute Macro Yes Yes Yes
Set Cursor Position Yes Yes Yes
Set Mouse Intercept Condition Yes Yes Yes
Set Presentation Space Service Condition Yes Yes Yes
Set Session Advise Condition Yes Yes Yes
Set Structured Field Service Condition Yes No No
Start Close Intercept Yes Yes Yes
Start Keystroke Intercept Yes Yes Yes
Start Mouse Input Intercept Yes Yes Yes
Start Read SF Yes No No
Start Session Advise Yes Yes Yes
Stop Close Intercept Yes Yes Yes
Stop Keystroke Intercept Yes Yes Yes
Stop Mouse Input Intercept Yes Yes Yes
Stop Read SF Yes No No
Stop Session Advise Yes Yes Yes
Terminate Session Conversation Yes Yes Yes
Terminate Structured Field Conversation Yes No No
Terminate System Conversation Yes Yes Yes
Write SF Yes No No

Refer to Summary of DDE Functions in a Windows 32-Bit Environment for a summary of the DDE functions.

Naming Conventions for Parameters

Most DDE parameter names have local variables. These variables have a prefix that indicates the general type of the parameter, followed by one or more words that describe the content of the parameter. Prefixes presented in this book are:

a
Atom
c
Character (a 1-byte value)
f
Bit flags packed into a 16-bit integer
h
16-bit handle
p
Short (16-bit) pointer
lp
Long (32-bit) pointer
w
Short (16-bit) unsigned integer
u
Unsigned integer
sz
Null-terminated character string

Code Conversion

3270 5250 VT
Yes Yes Yes

The Code Conversion function allows a client application to convert ASCII to EBCDIC or EBCDIC to ASCII. This function is only available to 32-bit applications.

Send the message as follows:

PostMessage (hServerWnd,
            WM_DDE_POKE,
            hClientWnd,
            PackDDEIParam (WM_DDE_POKE, hData, aCONV));

where:

hDATA
typedef struct tagWCDDE_CONV
{
    BYTE         ddepoke[(sizeof(DDEPOKE)-1)];
    char         szSourceName[256];   // name of memory-mapped file
    char         szTargetName[256];   // name of memory-mapped file
    BYTE         ConvType;            // Conversion method
    WORD         uSourceLength;       // Length of source buffer
    WORD         uTargetLength;       // Length of target buffer
}WCDDE_CONV;

typedef union tagDDE_CONV
{
     DDEPOKE     DDEpoke;
     WCDDE_CONV     DDEConv;
}DDE_CONV;

typedef DDE_CONV FAR *LPDDE_CONV;

Conversion Types

         ConvType = 0x01   ASCII to EBCDIC
         ConvType = 0x02   EBCDIC to ASCII
Note:
The string to be converted must be stored in a memory block that is accessible across processes. In Win32, this can only be accomplished by use of memory-mapped files. The global memory is created and named in the client application and the names are sent to Personal Communications through the DDE message. The steps required to implement this are demonstrated in the following example:
//Steps for a Source Buffer (done in client application)
HANDLE hMapFile;
LPVOID lpMapAddress;
ATOM   aCONV;

hMapFile = CreateFileMapping((HANDLE)0xFFFFFFFF,  // not a real file
    NULL,                                         // Default security.
    PAGE_READWRITE,                               // Read/write
    (DWORD)0,                                     // Ignored
    (DWORD)nStringLength,                         // Length of string
    (LPCTSTR)szSourceName);                       // Name of 
                                                  // mapping object.

If (hMapFile == NULL)
{
    MessageBox ("Could not create file-mapping Source object.");
    return;
}
// Now treat buffer like local memory
strcpy((LPSTR)lpMapAddress, szConcersionString);

// Repeat steps for a Target Buffer
.....
.....
// Set up ATOM information

aCONV = GlobalAddAtom("CONV"); // MUST be this string

// Post DDE Message Now ....

// When done with memory blocks, clean up
if (!UnmapViewOfFile(lpMapAddress))
{
     MessageBox ("Could not unmap view of Target.");
}

CloseHandle(hMapSFile);

// CODE ENDS

Personal Communications Response

The function responds with a WM_DDE_ACK message for DDE_POKE. A result value is returned in the high-order byte of the fsStatus word. The following return codes are valid:

Return Code Explanation
0x0000 Normal End
0x0200 An incorrect conversion type or incorrect parameter was specified
0x0600 An incorrect format was specified
0x0900 A system error occurred
0x1000 The destination buffer was exceeded
0x1100 An internal translation error occurred

Find Field

3270 5250 VT
Yes Yes Yes

The Find Field function returns information about the specified field to the client. It can be used in two ways.

Send the message as follows:

PostMessage( hServerWnd,
             WM_DDE_REQUEST,
             hClientWnd,
             MAKELPARAM(cfFormat, aFIELD) );

where:

cfFormat
Identifies the format for the field information. This value can be CF_DSPTEXT or CF_TEXT.
aFIELD
Is the atom that specifies the Find Field function. The string identified by the atom can have different values depending on the value of cfFormat.

CF_DSPTEXT

If CF_DSPTEXT is specified for cfFormat then aFIELD must be an atom that represents the string, FIELD. The PS position must be specified in a previous call to the Set Presentation Space Service Condition function. This version will return information only about the field which contains that position. The information will be returned in a WM_DDE_DATA(hData, aFIELD) message where:

hData
Represents
typedef struct tagFINDFIELD
{
  unsigned char
  data[sizeof(DDEDATA)-1];
  unsigned short uFieldStart;   //Field start position
  unsigned short uFieldLength;  //Field Length
  unsigned char  cAttribute;    //Attribute character value
  unsigned char  ubReserved;    //reserved, no information for client
} FINDFIELD;

typedef union tagDDE_FINDFIELD
{
  DDEDATA   DDEdata;
  FINDFIELD DDEfield;
} DDE_FINDFIELD, *lpDDE_FINDFIELD;

CF_TEXT

If CF_TEXT is specified for cfFormat then aFIELD must be an atom that represents the string, FIELD (pos, "XX") where:

pos
Is the PS position
XX
Is a code representing which field relative to pos for which information will be returned. These codes are described below:
Type Meaning
   or T  The field containing pos.
The field previous to pos, either protected or unprotected.
PP The previous protected field to pos.
PU The previous unprotected field to pos.
The next field after pos, either protected or unprotected.
NP The next protected field after pos.
NU The next unprotected field after pos.
Note:
The   symbol represents a required blank.

These codes must appear in quotes as demonstrated above. The information will be returned in a WM_DDE_DATA(hData, aFIELD) message where:

hData
Represents
typedef struct tagFINDFIELD_CF_TEXT
{
  uchar  data[sizeof(DDEDATA)-1];
  uchar  Fielddata[80];
} FINDFIELD_CF_TEXT;


typedef FINDFIELD_CF_TEXT FAR *LPFINDFIELD_CF_TEXT;

typedef union tagDDE_FIELD
{
  DDEDATA   DDEdata;
  FINDFIELD DDEFindField;
  FINDFIELD_CF_TEXT DDEFindField_cftext;
} DDE_FIELD;

typedef DDE_FIELD FAR *LPDDE_FIELD;

Personal Communications Response

If the function is successful, it will respond with a WM_DDE_DATA message with information as described above. If it fails, it will return with a WM_DDE_ACK(wStatus, aFIELD). A result value is returned in the low-order byte of the wStatus word. The following return codes are valid:

Return Code Explanation
0x0001 PS position is not valid.
0x0002 PS is unformatted.
0x0006 The specified format is not valid.
0x0009 A system error occurred.

Structure of the Field Information

The field information will be returned in the Fielddata member of the FINDFIELD_CF_TEXT structure as a string in the following formats.

For 3270:

"Formatted\t%01d\t%01d\t%01d\t%01d\t%04d\t%04d"
FA bit 2 Unprotected / Protected 0 or 1
FA bit 3 Alphanumeric / Numeric 0 or 1
FA bit 4-5 Intensity / High / Normal 1, 2 or 3
FA bit 7 Unmodified / Modified 0 or 1
Start Pos Field Start Position (excluding FA)
Length Field Length (excluding FA)
Note:
FA = Field Attribute

For 5250:

"Formatted\t%01d\t%01d\t%01d\t%01d\t%01d\t%01d\t%04d\t%04d"
FA bit 0 Field Attribute Flag 0 or 1
FA bit 1 Invisible / Visible 0 or 1
FA bit 2 Unprotected / Protected 0 or 1
FA bit 3 Intensity Low/High 0 or 1
FA bit 4-6 Field Type
  • 0 = Alphanumeric
  • 1 = Alphabetic
  • 2 = Numeric Shift
  • 3 = Numeric
  • 4 = Default
  • 5 = Digits only
  • 6 = Mag-Stripe Reader Data
  • 7 = Signed Numeric
0 -- 7
FA bit 7 Unmodified / Modified 0 or 1
Start Pos Field Start Position (excluding FA)
Length Field Length (excluding FA)
Note:
FA = Field Attribute

Get Keystrokes

3270 5250 VT
Yes Yes Yes

The Get Keystrokes function returns to the client the keystrokes that are intercepted by the Start Keystroke Intercept function. The client sends the following message to receive the keystroke information.

PostMessage( hServerWnd,
             WM_DDE_REQUEST,
             hClientWnd,
             MAKELPARAM(cfFormat, aKEYS) );

where:

cfFormat
Identifies the format for the keystroke information. This must be CF_DSPTEXT.
aKEYS
Identifies a keystroke data item.

Personal Communications Response

Personal Communications either returns the keystrokes in a DDE data message, or responds with one of these ACK messages containing status information:

If Personal Communications cannot return the keystroke information, one of the following status codes is returned in the low-order byte of the wStatus word:

Return Code Explanation
2 No keystroke was intercepted.
6 The specified format is not valid.
9 A system error occurred.

Structure of the Keystroke Information

Personal Communications returns the keystroke information in the following structure:

typedef struct tagKEYSTROKE
{
  unsigned char  data[(sizeof(DDEDATA)-1)];
  unsigned short uTextType;      /* Type of keystrokes
  unsigned char  szKeyData_1¨;   /* Keystrokes
} KEYSTROKE;

typedef union tagDDE_GETKEYSTROKE
{
  DDEDATA     DDEdata;
  KEYSTROKE   DDEkey;
} DDE_GETKEYSTROKE, *lpDDE_GETKEYSTROKE;

The format for the keystrokes parameters is the same as for the Session Execute Macro function SENDKEY command.

The following key text types are supported:

 PCS_PURETEXT   0         /* Pure text, no HLLAPI commands
 PCS_HLLAPITEXT 1         /* Text, including HLLAPI tokens

Get Mouse Input

3270 5250 VT
Yes Yes Yes

The Get Mouse Input function returns the latest mouse input intercepted by the Start Mouse Input Intercept function to the client.

Note:
The client must call the Start Mouse Input Intercept function before using this function.

The client sends the following command to receive the mouse input information.

PostMessage( hServerWnd,
             WM_DDE_REQUEST,
             hClientWnd,
             MAKELPARAM(cfFormat, aMOUSE) );

where:

cfFormat
Identifies the format for the presentation space. Valid values are CF_TEXT or CF_DSPTEXT. The structure of the mouse input data, in these two formats, is shown below.
aMOUSE
Identifies the mouse input as the item.

Personal Communications Response

Personal Communications either returns the mouse input data in a DDE data message, or responds with one of these ACK messages:

If Personal Communications cannot return the mouse input information, one of the following status codes is returned in the low-order byte of the wStatus word:

Return Code Explanation
2 No mouse input information was intercepted.
6 The specified format is not valid.
9 A system error occurred.

Structure of the Mouse Input Information

If the format is CF_TEXT, Personal Communications returns the mouse input information in the following format:

typedef struct tagMOUSE_CF_TEXT
{
  unsigned char data[(sizeof(DDEDATA)-1)];
  unsigned char PSPos[4];       /* PS Offset - Mouse position
  unsigned char Tab1[1];        /* Tab character
  unsigned char PSRowPos[4];    /* ROW number of Mouse position
  unsigned char Tab2[1];        /* Tab character
  unsigned char PSColPos[4];    /* Col number of Mouse position
  unsigned char Tab3[1];        /* Tab character
  unsigned char PSSize[4];      /* Size of Presentation Space
  unsigned char Tab4[1];        /* Tab character
  unsigned char PSRows[4];      /* Row number of PS
  unsigned char Tab5[1];        /* Tab character
  unsigned char PSCols[4];      /* Column number of PS
  unsigned char Tab6[1];        /* Tab character
  unsigned char Button[1];      /* Type of clicked mouse button
  unsigned char Tab7[1];        /* Tab character
  unsigned char Click[1];       /* Type of clicking
  unsigned char Tab8[1];        /* Tab character
  unsigned char zClickString[1];/* Retrieved string
} MOUSE_CF_TEXT;

typedef union tagDDE_MOUSE_CF_TEXT
{
  DDEDATA        DDEdata;
  MOUSE_CF_TEXT  DDEmouse;
} DDE_MOUSE_CF_TEXT, *lpDDE_MOUSE_CF_TEXT;

The following table shows the values in the parameters:

Parameter Name Meaning Value
PSPos PS offset of the position where the mouse was clicked 0 ... (PSSize - 1)
PSRowPos Row number of the position where the mouse was clicked 0 ... (PSRows - 1)
PSColPos Column number of the position where the mouse was clicked 0 ... (PSCols - 1)
PSSize Size of the presentation space
PSRows Number of rows of presentation space
PSCols Number of columns of presentation space
ButtonType Type of the clicked mouse button
L
Left button
M
Middle button
R
Right button
ClickType Type of clicking
S
Single click
D
Double click
ClickString Retrieved string to which the mouse pointed A character string terminated with a ‘\0’
Tab1-8 A tab character for delimiter ‘\t’

If the format is CF_DSPTEXT, Personal Communications returns the mouse input information in the following format:

typedef struct tagMOUSE_CF_DSPTEXT
{
  unsigned char  data[(sizeof(DDEDATA)-1)];
  unsigned short uPSPos;                    /* PS Offset of the Mouse position
  unsigned short uPSRowPos;                 /* ROW number of Mouse position
  unsigned short uPSColPos;                 /* Column number of Mouse position
  unsigned short uPSSize;                   /* Size of Presentation Space
  unsigned short uPSRows;                   /* Row number of PS
  unsigned short uPSCols;                   /* Column number of PS
  unsigned short uButtonType;               /* Type of clicked mouse button
  unsigned short uClickType;                /* Type of clicking
  unsigned char  zClickString[1];             /* Retrieved string
} MOUSE_CF_DSPTEXT;

typedef union tagDDE_MOUSE_CF_DSPTEXT
{
  DDEDATA           DDEdata;
  MOUSE_CF_DSPTEXT  DDEmouse;
} DDE_MOUSE_CF_DSPTEXT, *lpDDE_MOUSE_CF_DSPTEXT;

The following table shows the values in the parameters:

Parameter Name Meaning Value
uPSPos PS offset of the position where the mouse was clicked 0 ... (uPSSize - 1)
uPSRowPos Row number of the position where the mouse was clicked 0 ... (uPSRows - 1)
uPSColPos Column number of the position where the mouse was clicked 0 ... (uPSCols - 1)
uPSSize Size of the presentation space
uPSRows Number of rows of the presentation space
uPSCols Number of columns of the presentation space
uButtonType Type of the clicked mouse button
0x0001
Left button
0x0002
Middle button
0x0003
Right button
uClickType Type of clicking
0x0001
Single click
0x0002
Double click
szClickString Retrieved string that the mouse pointed to A character string terminated with a ‘\0’

Get Number of Close Requests

3270 5250 VT
Yes Yes Yes

The Get Number of Close Requests function returns to the client the number of the close requests that are intercepted by the Start Close Intercept function. The client sends the following message to receive the number of the close requests.

PostMessage( hServerWnd,
             WM_DDE_REQUEST,
             hClientWnd,
             MAKELPARAM(cfFormat, aCLOSE) );

where:

cfFormat
Identifies the format for the close intercept information. This must be CF_DSPTEXT.
aCLOSE
Identifies a close intercept data item.

Personal Communications Response

Personal Communications either returns the number of the close requests in a DDE data message, or responds with one of these ACK messages:

If Personal Communications cannot return the close intercept information, one of the following status codes is returned in the low order byte of the wStatus word:

Return Code Explanation
6 The specified format is not valid.
9 A system error occurred.

Structure of the Number of the Close Requests Information

Personal Communications returns the close intercept information in the following structure:

typedef struct tagCLOSEREQ
{
  unsigned char  data[(sizeof(DDEDATA)-1)];
  unsigned short uCloseReqCount; /* Number of the close requests.
} CLOSEREQ;

typedef union tagDDE_CLOSEREQ
{
  DDEDATA   DDEdata;
  CLOSEREQ  DDEclose;
} DDE_CLOSEREQ, *lpDDE_CLOSEREQ;

Get Operator Information Area

3270 5250 VT
Yes Yes Yes

The Get Operator Information Area (OIA) function returns a copy of the OIA to the client. The client sends the following message to request the OIA.

PostMessage( hServerWnd,
             WM_DDE_REQUEST,
             hClientWnd,
             MAKELPARAM(cfFormat, aOIA) );

where:

cfFormat
Identifies the format for the OIA. For the OIA, this format must be CF_DSPTEXT.
aOIA
Identifies the operator information area as the item.

Personal Communications Response

Personal Communications either returns the OIA in a DDE data message, or responds with one of these ACK messages:

If Personal Communications cannot return the OIA, one of the following status codes is returned in the low-order byte of the wStatus word:

Return Code Explanation
6 The specified format is not valid.
9 A system error occurred.

Structure of the Operator Information Area

Personal Communications returns the operator information area in the following structure:

typedef struct tagOIADATA
{
  unsigned char  data[(sizeof(DDEDATA)-1)];
  unsigned char  OIA[80];
} OIADATA;

typedef union tagDDE_OIADATA
{
  DDEDATA   DDEdata;
  OIADATA   DDEoia;
} DDE_OIADATA, *lpDDE_OIADATA;

Get Partial Presentation Space

3270 5250 VT
Yes Yes Yes

The Get Partial Presentation Space function returns all or part of the session presentation space to the client.

Note:
The client must set the start PS position and either the PS length or End of Field (EOF) flag by using the Set Presentation Space Service Condition function before using this function. If the EOF flag is set to PCS_EFFECTEOF, the function will return the entire field specified by the start PS position

The client sends the following command to get the presentation space.

PostMessage( hServerWnd,
             WM_DDE_REQUEST,
             hClientWnd,
             MAKELPARAM(cfFormat, aEPS) );

where:

cfFormat
Identifies the format for the presentation space. Valid values are CF_TEXT or CF_DSPTEXT. The structure of the presentation space, in these two formats, is shown below.
aEPS
Identifies the session presentation space as the item.

Personal Communications Response

Personal Communications either returns the presentation space data, or responds with one of these ACK messages containing an error code in the low order byte of the wStatus word:

If Personal Communications cannot return the presentation space, one of the following status codes is returned in the low-order byte of the wStatus word:

Return Code Explanation
1 No prior Set Presentation Space Service Condition function was called, or an incorrect parameter was set.
6 The specified format is not valid.
9 A system error occurred.

Structure of the Presentation Space

Personal Communications returns the part of the presentation space in the format specified in the Get Partial Presentation Space request.

If the format is CF_DSPTEXT, Personal Communications returns the presentation space in the following format:

typedef struct tagEPS_CF_DSPTEXT
{
  unsigned char  data[(sizeof(DDEDATA)-1)];
  unsigned short uPSPosition;       /* Position of the part of PS
  unsigned short uPSLength;         /* Length of the part of the PS
  unsigned short uPSRows;           /* PS number of rows
  unsigned short uPSCols;           /* PS number of columns
  unsigned short uPSOffset;         /* Offset to the presentation space
  unsigned short uFieldCount;       /* Number of fields
  unsigned short uFieldOffset;      /* Offset to the field array
  unsigned char  PSData[1];     /* PS + Field list Array(lpPSFIELDS)
} EPS_CF_DSPTEXT;

typedef union tagDDE_EPS_CF_DSPTEXT
{
  DDEDATA         DDEdata;
  EPS_CF_DSPTEXT  DDEeps;
} DDE_EPS_CF_DSPTEXT, *lpDDE_EPS_CF_DSPTEXT;

# The PSFIELDS structure is replaced with below structure.

typedef struct tagPSFIELDS
{
  unsigned short uFieldStart;    /* Field start offset
  unsigned short uFieldLength;   /* Field Length
  unsigned char  cAttribute;     /* Attribute character
  unsigned char  ubReserved;     /* *** Reserved ***
} PSFIELDS, *lpPSFIELDS;

Note:
The following examples show how to obtain long pointers to the PS and the PSFIELDS array.

lpDDE = (lpDDE_EPS_CF_DSPTEXT)GlobalLock(hData);
lpps = lpDDE->DDEeps.PSData + lpDDE->DDEeps.uPSOffset;
lppsfields = lpDDE->DDEeps.PSData + lpDDE->DDEeps.uFieldOffset;

If the format is CF_TEXT, Personal Communications returns the part of the presentation space in the following format:

typedef struct tagEPS_CF_TEXT
{
  unsigned char  data[(sizeof(DDEDATA)-1)];
  unsigned char  PSPOSITION[4];/* Position of part of the PS
  unsigned char  Tab1[1];      /* Tab character
  unsigned char  PSLENGTH[4];  /* Length of the part of the PS
  unsigned char  Tab2[1];      /* Tab character
  unsigned char  PSROWS[4];    /* Number of rows in the PS
  unsigned char  Tab3[1];      /* Tab character
  unsigned char  PSCOLS[4];    /* Number of Cols in the PS
  unsigned char  Tab4[1];      /* Tab character
  unsigned char  PS[1];        /* PS
} EPS_CF_TEXT;

typedef union tagDDE_EPS_CF_TEXT
{
  DDEDATA      DDEdata;
  EPS_CF_TEXT  DDEeps;
} DDE_EPS_CF_TEXT, *lpDDE_EPS_CF_TEXT;

Following the PS in the buffer is the following additional structure of fields that compose the field list.

typedef struct tagFL_CF_TEXT
{
  unsigned char  Tab5[1];        /* Tab character
  unsigned char  PSFldCount[4];  /* Number of fields in the PS
  unsigned char  Tab6[1];        /* Tab character
  PS_FIELD       Field[1];       /* Field List Array
} FL_CF_TEXT, *lpFL_CF_TEXT;

typedef struct tagPS_FIELD
{
  unsigned char  FieldStart[4];
  unsigned char  TabF1[1];
  unsigned char  FieldLength[4];
  unsigned char  TabF2[1];

Note:
The following examples show how to obtain long pointers to the PS and the PS_FIELD array.

lpDDE = (lpDDE_EPS_CF_TEXT)GlobalLock(hData);
lpps = lpDDE->DDEeps.PS;
lpps_field = lpDDE->DDEeps.PS
           + atoi(lpDDE->DDEeps.PSLENGTH)
           + ((atoi(lpDDE->DDEeps.PSROWS) -1) * 2) // CR/LF
           + 1 + 1 + 4 + 1;  // Tabs + size of field count

Get Presentation Space

3270 5250 VT
Yes Yes Yes

The Get Presentation Space function returns the session presentation space to the client. The client sends the following command to get the presentation space.

PostMessage( hServerWnd,
             WM_DDE_REQUEST,
             hClientWnd,
             MAKELPARAM(cfFormat, aPS) );

where:

cfFormat
Identifies the format for the presentation space. Valid values are CF_TEXT or CF_DSPTEXT. The structure of the presentation space, in these two formats, is shown below.
aPS
Identifies the session presentation space as the item.

Personal Communications Response

Personal Communications either returns the presentation space and a list of the fields that comprise the presentation space, or responds with one of these ACK messages containing an error code in the low-order byte of the wStatus word:

If Personal Communications cannot return the presentation space, one of the following status codes is returned in the low-order byte of the wStatus word:

Return Code Explanation
6 The specified format is not valid.
9 A system error occurred.

Structure of the Presentation Space

Personal Communications returns the presentation space in the format specified in the Get Presentation Space request.

If the format is CF_DSPTEXT, Personal Communications returns the presentation space in the following format:

typedef struct tagPS_CF_DSPTEXT
{
  unsigned char  data[(sizeof(DDEDATA)-1)];
  unsigned short uPSSize;        /* Size of the presentation space
  unsigned short uPSRows;        /* PS number of rows
  unsigned short uPSCols;        /* PS number of columns
  unsigned short uPSOffset;      /* Offset to the presentation space
  unsigned short uFieldCount;    /* Number of fields
  unsigned short uFieldOffset;   /* Offset to the field array
  unsigned char  PSData_1¨;      /* PS and Field list Array(lpPSFIELDS)
} PS_CF_DSPTEXT;

typedef union tagDDE_PS_CF_DSPTEXT
{
  DDEDATA        DDEdata;
  PS_CF_DSPTEXT  DDEps;
} DDE_PS_CF_DSPTEXT, *lpDDE_PS_CF_DSPTEXT;

typedef struct tagPSFIELDS
{
  unsigned short uFieldStart;    /* Field start offset
  unsigned short uFieldLength;   /* Field Length
  unsigned char  cAttribute;     /* Attribute character
  unsigned char  ubReserved;     /* *** Reserved ***
} PSFIELDS, *lpPSFIELDS;

Note:
The following examples show how to obtain long pointers to the PS and the PSFIELDS array.

lpDDE = (lpDDE_PS_CF_DSPTEXT)GlobalLock(hData);
lpps = lpDDE->DDEps.PSData + lpDDE->DDEps.uPSOffset;
lppsfields = lpDDE->DDEps.PSData + lpDDE->DDEps.uFieldOffset;

If the format is CF_TEXT, Personal Communications returns the presentation space in the following format:

typedef struct tagPS_CF_TEXT
{
  unsigned char  data[(sizeof(DDEDATA)-1)];
  unsigned char  PSSIZE[4];      /* Size of the PS
  unsigned char  Tab1[1];        /* Tab character
  unsigned char  PSROWS[4];      /* Number of rows in the PS
  unsigned char  Tab2[1];        /* Tab character
  unsigned char  PSCOLS[4];      /* Number of Cols in the PS
  unsigned char  Tab3[1];        /* Tab character
  unsigned char  PS[1];          /* PS
} PS_CF_TEXT;

typedef union tagDDE_PS_CF_TEXT
{
  DDEDATA     DDEdata;
  PS_CF_TEXT  DDEps;
} DDE_PS_CF_TEXT, *lpDDE_PS_CF_TEXT;

Following the PS in the buffer is the following additional structure of fields that compose the field list.

typedef struct tagPS_FIELD
{
  unsigned char  FieldStart[4];
  unsigned char  TabF1[1];
  unsigned char  FieldLength[4];
  unsigned char  TabF2[1];
  unsigned char  Attribute;
  unsigned char  TabF3[1];
} PS_FIELD, *lpPS_FIELD;

Note:
The following example shows how to obtain long pointers to the PS and the PS_FIELD array.

lpDDE = (lpDDE_PS_CF_TEXT)GlobalLock(hData);
lpps = lpDDE->DDEps.PS;
lpps_field = lpDDE->DDEps.PS
           + atoi(lpDDE->DDEps.PSSIZE)
           + ((atoi(lpDDE->DDEps.PSROWS) -1) * 2) // CR/LF
           + 1 + 1 + 4 + 1;  // Tabs + size of field count

Get Session Status

3270 5250 VT
Yes Yes Yes

The Get Session Status function returns the status of the connected session. The client sends the following message to request session status:

PostMessage( hServerWnd,
             WM_DDE_REQUEST,
             hClientWnd,
             MAKELPARAM(cfFormat, aSSTAT) );

where:

cfFormat
Identifies the DDE format for the status information. The value used is CF_TEXT.
aSSTAT
Identifies session status as the data item requested.

Personal Communications Response

Personal Communications either returns the session status in a DDE data message, or responds with one of these ACK messages containing status information:

If Personal Communications cannot return the session status, one of the following status codes is returned in the low-order byte of the wStatus word:

Return Code Explanation
6 The specified format is not valid.
9 A system error occurred.

Format of Status Information

Personal Communications returns the session status as text in CF_TEXT format. The following fields are returned with the following possible values:

Fields Returned Values Description
Status Closed, Invisible, Maximized, Minimized, Normal The window is in one of these states.
Usage DDE, User The session is connected in either a DDE session or a user session.
ScreenX NN Defines the horizontal size of the screen.
ScreenY NN Defines the vertical size of the screen.
CursorX NN Defines the horizontal position of the cursor. (0 ... ScreenX - 1)
CursorY NN Defines the vertical position of the cursor. (0 ... ScreenY - 1)
TrimRect Status Closed, Moved, Sized The current status of the trim rectangle.
Trim Rectangle X1 N The top-left corner X position of the trim rectangle in character coordinates.
Trim Rectangle Y1 N The top-left corner Y position of the trim rectangle in character coordinates.
Trim Rectangle X2 N The lower-right corner X position of the trim rectangle in character coordinates.
Trim Rectangle Y2 N The lower-right corner Y position of the trim rectangle in character coordinates.
Session Presentation Space Status N The current status of the presentation space. The following values are possible:
0:
The presentation space is unlocked.
4:
The presentation space is busy.
5:
The presentation space is locked.
Session Window Handle XXXX Window handle of the session.
Note:

Get System Configuration

3270 5250 VT
Yes Yes Yes

The Get System Configuration function returns the level of Personal Communications support and other system-related values. Most of this information is for use by a service coordinator when a customer calls the IBM® Support Center after receiving a system error.

PostMessage( hServerWnd,
             WM_DDE_REQUEST,
             hClientWnd,
             MAKELPARAM(cfFormat, aSYSCON) );

where:

cfFormat
Identifies the DDE format for the data item requested. The value used is CF_TEXT.
aSYSCON
Identifies system configuration as the data item requested.

Personal Communications Response

Personal Communications either returns the system configuration data item in a DDE DATA message, or responds with one of these ACK messages containing status information:

If Personal Communications cannot return the system configuration, a DDE ACK message is returned with an error code in the low-order byte of the wStatus word:

WM_DDE_ACK(wStatus, aSYSCON)
Return Code Explanation
9 A system error occurred.

Format of System Configuration Information

Personal Communications returns the system configuration as text in CF_TEXT format. The following fields are returned with the following possible values:

Fields Returned values Description
Version N The version of Personal Communications
Level NN The level of Personal Communications
Reserved XXXXXX Reserved
Reserved XXXX Reserved
Monitor Type MONO, CGA, EGA, VGA, XGA Type of the monitor
Country Code NNNN Country code used with 3270 or 5250

Get System Formats

3270 5250 VT
Yes Yes Yes

The Get System Formats function returns the list of Windows clipboard formats supported by Personal Communications. The client application sends the following message to retrieve the format list supported by Personal Communications:

PostMessage( hServerWnd,
             WM_DDE_REQUEST,
             hClientWnd,
             MAKELPARAM(cfFormat, aFORMATS) );

where:

cfFormat
Identifies the DDE format for the data item requested. The value used is CF_TEXT.
aFORMATS
Identifies formats as the data item requested.

Personal Communications Response

Personal Communications returns the list of supported Windows clipboard formats in CF_TEXT format in a DDE DATA message.

WM_DDE_DATA(hData, aFORMATS)

The following Windows clipboard formats are supported by Personal Communications:

If Personal Communications cannot return the formats data item, a DDE ACK message is returned with an error code in the low-order byte of the wStatus word:

WM_DDE_ACK(wStatus, aFORMATS)

Return Code Explanation
9 A system error occurred.

Get System Status

3270 5250 VT
Yes Yes Yes

The Get System Status function returns the status of each 3270 or 5250 session that is available with the current Personal Communications configuration. The client application sends the following message to retrieve the status data item:

PostMessage( hServerWnd,
             WM_DDE_REQUEST,
             hClientWnd,
             MAKELPARAM(cfFormat, aSTATUS) );

where:

cfFormat
Identifies the DDE format for the data item requested. The value used is CF_TEXT.
aSTATUS
Identifies status as the data item requested.

Personal Communications Response

Personal Communications returns the status data item in CF_TEXT format in a DDE DATA message:

WM_DDE_DATA(hData, aSTATUS)

For each opened session, Personal Communications returns a line of status information. Each line contains a series of fields with the following range of values:

Fields Range of values Description
Session ID A, B, ..., Z The short ID of the session.
Host Type 370, 400, ASCII The host system currently supported by Personal Communications.
Emulation Type 3270, 5250, VT The emulation type supported by Personal Communications.
Session Status Closed, Invisible, Normal, Minimized, Maximized The current status of the session's window.

If Personal Communications cannot return the status data item, a DDE ACK message is returned with an error code in the low-order byte of the wStatus word:

WM_DDE_ACK(wStatus, aSTATUS)

Return Code Explanation
9 A system error occurred.

Get System SysItems

3270 5250 VT
Yes Yes Yes

Personal Communications supports the DDE system topic so that a client application can connect to the system topic and retrieve information about Personal Communications and the status of the sessions that Personal Communications is managing.

The Get System SysItems function returns the list of data items available in the Personal Communications system topic. The client application sends the following message to get the system topic data items:

PostMessage( hServerWnd,
             WM_DDE_REQUEST,
             hClientWnd,
             MAKELPARAM(cfFormat, aSYSITEMS) );

where:

cfFormat
Identifies the DDE format for the data item requested. The value used is CF_TEXT.
aSYSITEMS
Identifies SysItems as the data item requested.

Personal Communications Response

Personal Communications returns the list of system topic data items in CF_TEXT format in a DDE DATA message.

WM_DDE_DATA(hData, aSYSITEMS)

The following data items are supported by Personal Communications:

If Personal Communications cannot return the system data items, a DDE ACK message is returned with an error code in the low-order byte of the wStatus word:

WM_DDE_ACK(wStatus, aSYSITEMS)

Return Code Explanation
9 A system error occurred.

Get System Topics

3270 5250 VT
Yes Yes Yes

The Get System Topics function returns the list of active DDE topics currently supported by Personal Communications. The client application sends the following message to the system topic to retrieve the list of topics that are currently active:

PostMessage( hServerWnd,
             WM_DDE_REQUEST,
             hClientWnd,
             MAKELPARAM(cfFormat, aTOPICS) );

where:

cfFormat
Identifies the DDE format for the data item requested. The value used is CF_TEXT.
aTOPICS
Identifies topics as the data item requested.

Personal Communications Response

Personal Communications returns the list of DDE topics in CF_TEXT format in a DDE DATA message.

WM_DDE_DATA(hData, aTOPICS)

The following list of topics are supported by Personal Communications:

Note:
The actual number of session topics supported depends on the number of sessions currently opened. The client program should always query the topics data item of the system topic to obtain the list of sessions currently opened.

If Personal Communications cannot return the list of topics, a DDE ACK message will be returned with an error code in the low-order byte of the wStatus word:

WM_DDE_ACK(wStatus, aTOPICS)

Return Code Explanation
9 A system error occurred.

Get Trim Rectangle

3270 5250 VT
Yes Yes Yes

The Get Trim Rectangle function returns to the client the area of the presentation space that is within the current trim rectangle. The client sends the following message to receive the trim rectangle.

PostMessage( hServerWnd,
             WM_DDE_REQUEST,
             hClientWnd,
             MAKELPARAM(cfFormat, aTRIMRECT) );

where:

cfFormat
Identifies the format for the trim rectangle. This is CF_TEXT.
aTRIMRECT
Identifies trim rectangle as the data item requested.

Personal Communications Response

Personal Communications either returns trim rectangle in a DDE data message, or responds with one of these ACK messages:

If Personal Communications cannot return the trim rectangle, one of the following status codes is returned in the low-order byte of the wStatus word:

Return Code Explanation
6 The specified format is not valid.
9 A system error occurred.

Initiate Session Conversation

3270 5250 VT
Yes Yes Yes

The Initiate Session Conversation function connects a client application to an available session of Personal Communications. Once a session conversation has been established, the session is reserved for exclusive use by the client until the conversation is terminated.

The client application sends the following message to initiate a DDE conversation with a session:

SendMessage( -1,
             WM_DDE_INITIATE,
             hClientWnd,
             MAKELPARAM(aIBM327032, aSessionN) );

where:

aIBM327032
Identifies the application atom. The string used to create atom aIBM327032 is IBM327032. In the PC400, the application atom is aIBM525032 and the string IBM525032 is used to create it.
aSessionN
Identifies the topic atom. The string used to create atom aSessionN is either NULL or Session appended with the session ID A, B, ..., Z.

Personal Communications Response

If a specific topic is selected and Personal Communications can support a conversation with the client application, Personal Communications acknowledges the INITIATE transaction with:

WM_DDE_ACK(aIBM327032, aSessionN)

If a topic is not selected (aSessionN = NULL), Personal Communications responds by acknowledging all topics that are currently available:

WM_DDE_ACK(aIBM327032, aSystem)
WM_DDE_ACK(aIBM327032, aSessionA)

·
·
·
WM_DDE_ACK(aIBM327032, aSessionZ)

The client application selects the conversation it wishes to communicate with from the returned list of topics and terminates all other unwanted conversations.

Initiate Structured Field Conversation

3270 5250 VT
Yes No No

The Initiate Structured Field Conversation function connects a client application and a host application. This allows the applications to send data to each other and to receive data from each other.

The client sends the following command to initiate a structured field conversation:

SendMessage( -1,
             WM_DDE_INITIATE,
             hClientWnd,
             MAKELPARAM(aIBM327032, aLUN_xxxx) );

Where:

aIBM327032
Identifies the application atom.
aLUN_xxxx
Identifies the topic atom. The string used to create atom aLUN_xxxx is LU appended with the session ID A, B, ..., Z, appended with an underscore (_), and appended with the user-defined string of any length.

PC/3270 Response

If PC/3270 can support a structured field conversation with the client application, it returns an acknowledgment message with the following parameter:

WM_DDE_ACK(aIBM327032, aLUN_xxxx)

Initiate System Conversation

3270 5250 VT
Yes Yes Yes

The Initiate System Conversation function connects a client application to the system conversation. Only one client can be connected to the system conversation at a given time. The client sends the following command to initiate a system conversation:

SendMessage( -1,
             WM_DDE_INITIATE,
             hClientWnd,
             MAKELPARAM(aIBM327032, aSystem) );

where:

aIBM327032
Identifies the application atom.
aSystem
Identifies the topic atom.

Personal Communications Response

If Personal Communications can support a system topic conversation with the client application, it returns an acknowledgment message with the following parameters:

WM_DDE_ACK(aIBM327032, aSystem)

Put Data to Presentation Space

3270 5250 VT
Yes Yes Yes

The Put Data to Presentation Space function sends an ASCIIZ data string to be written into the host presentation space at the location specified by the calling parameter. The client sends the following message to the session to send the string.

PostMessage( hServerWnd,
             WM_DDE_POKE,
             hClientWnd,
             PackDDElParam(WM_DDE_POKE,
             hdata, aEPS) );

where:

hData
Identifies a handle to a Windows global memory object that contains the string to be sent to the session. The global memory object contains the following structure:
typedef struct tagPutString
{
  unsigned char  poke[(sizeof(DDEPOKE)-1)];
  unsigned short uPSStart;                       /* PS Position
  unsigned short uEOFflag;                       /* EOF effective switch
  unsigned char  szStringData[1];                 /* String Data
} PUTSTRING;

typedef union tagDDE_PUTSTRING
{
  DDEPOKE    DDEpoke;
  PUTSTRING  DDEputstring;
} DDE_PUTSTRING, *lpDDE_PUTSTRING;

These values are valid at the uEOFflag field:

 PCS_UNEFFECTEOF 0        /* The string is not truncated at EOF.
 PCS_EFFECTEOF   1        /* The string is truncated at EOF.
aEPS
Identifies the presentation space atom as the item.

Personal Communications Response

Personal Communications receives the string data and sends them to the presentation space, and returns a positive ACK message.

If the presentation space does not accept the string data, Personal Communications returns a negative ACK message containing one of the following status codes in the low-order byte of the wStatus word:

WM_DDE_ACK(wStatus, aEPS)

Return Code Explanation
1 PS position is not valid.
2 Length is not valid.
3 The value of EOF flag is not valid.
5 Input to the target PS was inhibited.
6 The specified format is not valid.
7 The string was truncated (successful putting).
9 A system error occurred.

Search for String

3270 5250 VT
Yes Yes Yes

This function allows a client application to examine the presentation space for a specified string in a specified area.

Note:
The client must set the start PS position, string to be searched for, and either the PS Length and Search Direction or End of Field (EOF) flag by using the Set Presentation Space Service Condition function before using this function. If the EOF flag is set to PCS_EFFECTEOF, the function will search the entire field specified by the Start PS Position parameter.

The client sends the following message to search for the string.

PostMessage( hServerWnd,
             WM_DDE_REQUEST,
             hClientWnd,
             MAKELPARAM(cfFormat, aSTRING) );

where:

cfFormat
Identifies the format for the search information. This must be CF_DSPTEXT.
aSTRING
Identifies the search data item.

Personal Communications Response

Personal Communications returns the start position of the string in a DDE data message if the string was found in the specified area:

If Personal Communications cannot return the start position of the string, one of the following status codes is returned in the low-order byte of the wStatus word:

Return Code Explanation
1 PS position is not valid or the string is too long.
2 The string cannot be found.
6 The specified format is not valid.
9 A system error occurred.

Structure of the Search Information

Personal Communications returns the search information in the following structure:

typedef struct tagSEARCH
{
  unsigned char  data[(sizeof(DDEDATA)-1)];
  unsigned short uFieldStart;    /* String start offset
} SEARCH;

typedef union tagSEARCH
{
  DDEDATA  DDEdata;
  SEARCH   DDEsearch;
} DDE_SEARCH, *lpDDE_SEARCH;

Send Keystrokes

3270 5250 VT
Yes Yes Yes

The Send Keystrokes function sends keystrokes to the connected session. The client sends the following message to the session to send keystrokes.

PostMessage( hServerWnd,
             WM_DDE_POKE,
             hClientWnd,
             PackDDElParam(WM_DDE_POKE,
             hData, aKEYS) );

where:

hData
Identifies a handle to a Windows global memory object that contains the keystrokes to be sent to the session. The global memory object contains the following structure:
typedef struct tagKeystrokes
{
  unsigned char  poke[(sizeof(DDEPOKE)-1)];
  unsigned short uTextType;                /* Type of keystrokes
  unsigned short uRetryCount;              /* Retry count 1 .. 16
  unsigned char  szKeyData[1];      /* Keystrokes
} KEYSTROKES;

typedef union tagDDE_SENDKEYSTROKES
{
  DDEPOKE     DDEpoke;
  KEYSTROKES  DDEkeys;
} DDE_SENDKEYSTROKES, *lpDDE_SENDKEYSTROKES;

The following key text types are supported:

 PCS_PURETEXT   0         /* Pure text, no HLLAPI commands
 PCS_HLLAPITEXT 1         /* Text, including HLLAPI tokens

Note:
If the keystrokes are pure text, then specifying PCS_PURETEXT will transfer the keystrokes to the host in the fastest possible manner. If PCS_HLLAPITEXT is specified, then the keystroke data can contain HLLAPI commands interspersed with the text.
aKEYS
Identifies keystrokes as the item.

Personal Communications Response

Personal Communications receives the keystrokes and sends them to the presentation space. If the presentation space does not accept the keystrokes, a reset is sent to the presentation space and the keystrokes are sent again. This procedure continues until the presentation space accepts the keystrokes or the retry count is reached. If Personal Communications cannot send the keystrokes to the host, Personal Communications returns a negative ACK message containing one of the following status codes in the low-order byte of the wStatus word. Otherwise, Personal Communications returns a positive ACK message signalling the keystrokes have been sent.

WM_DDE_ACK(wStatus, aKEYS)

Return Code Explanation
1 Retry count is not valid.
2 Type of key strokes is not valid.
6 The specified format is not valid.
9 A system error occurred.

Session Execute Macro

3270 5250 VT
Yes Yes Yes

You can issue commands and macros with the DDE_EXECUTE function. The DDE_EXECUTE function passes command strings to Personal Communications. The command strings must conform to DDE specifications. Refer to Microsoft Windows Software Development Kit Guide to Programming for more information about the DDE command syntax.

The client sends the following command to issue a DDE_EXECUTE function.

PostMessage ( hServerWnd,
              WM_DDE_EXECUTE,
              hClientWnd,
              (LPARAM)hCommands) );

where:

hCommands
Identifies a handle to a Windows global memory object containing Personal Communications commands. For a list of commands you can issue, see Issuing Commands with the Session Execute Macro Function.

Personal Communications Response

If Personal Communications can process the command string, Personal Communications returns an ACK message containing positive status information to the client. If Personal Communications cannot perform the command string, Personal Communications returns an ACK message containing this error code in the low-order word of the wStatus word:

Return Code Explanation
9 A system error occurred.

Issuing Commands with the Session Execute Macro Function

You can issue the following commands with the Session Execute Macro function:

Use a separate DDE_EXECUTE message for each command.

Note:

WINDOW Command

[WINDOW(action[, "name"])]

Performs window actions, where:

    action = HIDE|RESTORE|MAXIMIZE|MINIMIZE|
             SHOW|CNGNAME
    name = LT name or Switch List Entry name
 

Note:
name should be specified when CNGNAME is specified at action. If name is a NULL string, the default caption will be displayed.

KEYBOARD Command

[KEYBOARD(action)]

Enables or disables the session keyboard, including the mouse, where:


    action= LOCK|UNLOCK
 

SEND Command

[SEND("pcfilename","hostfilename","options")]

Sends files to the host, where:

    pcfilename = [path]filename[.ext]
    hostfilename =
      For VM system:
        filename filetype[filemode]
      For MVS system:
         [']filename[(membername)][']
      For CICS system:
      For OS/400 system:
        library name filename member name
 

Any combination of the following file transfer options can be included in options: MVS, VM, CICS, QUIET, OS/400, and emulation-specific transfer options, separated by spaces.

Refer to Administrator's Guide and Reference for more information about the transfer options.

RECEIVE Command

[RECEIVE("pcfilename","hostfilename","options")]

Receives files from the host, where:

    pcfilename = [path]filename[.ext]
    hostfilename =
      For VM system:
        filename filetype[filemode]
      For MVS system:
         [']filename[(membername)][']
      For CICS system:
      For OS/400 system:
        library name filename member name
 

Any combination of the following file transfer options can be included in options: MVS, VM, CICS, QUIET, OS/400, and emulation-specific transfer options, separated by spaces.

Refer to Administrator's Guide and Reference for more information about the transfer options.

SENDKEY Command

[SENDKEY(token,token)]

Sends keystrokes to Personal Communications, where:

    token = text string|command|macro macroname

Notes:
  1. Text strings are enclosed in double quotation marks.
  2. Macros are prefixed with "macro".
  3. The argument string for SENDKEY must be 255 characters or fewer.
  4. The following commands are supported.
Table 19. SENDKEY Command List
Command Name Token PC/3270 PC400 VT
Alternate Cursor alt cursor Yes Yes No
Alternate Viewing Mode alt view Yes Yes No
Attention sys attn Yes Yes No
Backspace backspace Yes Yes Yes
Back Tab backtab Yes Yes No
Backtab Word backtab word Yes Yes No
Character Advance character advance No Yes No
Character Backspace backspace valid No Yes No
Clear Screen clear Yes Yes No
Clicker click Yes Yes No
Color Blue blue Yes No No
Color Field Inherit field color Yes No No
Color Green green Yes No No
Color Pink pink Yes No No
Color Red red Yes No No
Color Turquoise turquoise Yes No No
Color White white Yes No No
Color Yellow yellow Yes No No
Cursor Blink cursor blink Yes Yes No
Cursor Down down Yes Yes Yes
Cursor Left left Yes Yes Yes
Cursor Right right Yes Yes Yes
Cursor Select cursor select Yes Yes No
Cursor Up up Yes Yes Yes
Delete Character delete char Yes Yes No
Delete Word delete word Yes Yes No
Device Cancel device cancel Yes Yes No
Dup Field dup Yes Yes No
Edit Clear edit-clear Yes Yes Yes
Edit Copy edit-copy Yes Yes Yes
Edit Cut edit-cut Yes Yes Yes
Edit Paste edit-paste Yes Yes Yes
Edit Undo edit-undo Yes Yes Yes
End Field end field Yes Yes No
Enter enter Yes Yes No
Erase EOF erase eof Yes Yes No
Erase Field erase field Yes No No
Erase Input erase input Yes Yes No
Fast Cursor Down fast down Yes Yes No
Fast Cursor Left fast left Yes Yes No
Fast Cursor Right fast right Yes Yes No
Fast Cursor Up fast up Yes Yes No
Field Exit field exit No Yes No
Field Mark field mark Yes Yes No
Field + field + No Yes No
Field - field - No Yes No
Graphic Cursor +cr Yes No No
Help help Yes Yes No
Highlighting Field Inherit field hilight Yes No No
Highlighting Reverse reverse Yes No No
Highlighting Underscore underscore Yes No No
Home home Yes Yes No
Host Print host print Yes No No
Input input Yes Yes No
Input nondisplay input nd Yes Yes No
Insert Toggle insert Yes Yes No
Lower case to lower Yes No No
Mark Down mark down Yes Yes Yes
Mark Left mark left Yes Yes Yes
Mark Right mark right Yes Yes Yes
Mark Up mark up Yes Yes Yes
Move Mark Down move down Yes Yes Yes
Move Mark Left move left Yes Yes Yes
Move Mark Right move right Yes Yes Yes
Move Mark Up move up Yes Yes Yes
New Line newline Yes Yes Yes
Next Page page down No Yes No
Pause 1 second pause Yes Yes No
Previous Page page up No Yes No
Print Screen local copy Yes Yes Yes
Program Attention Key 1 pa1 Yes No No
Program Attention Key 2 pa2 Yes No No
Program Attention Key 3 pa3 Yes No No
Program Function Key 1
  ·
  ·
  ·
Program Function Key 5
pf1
  ·
  ·
  ·
pf5
Yes
·
·
·
Yes
Yes
·
·
·
Yes
No
  ·
  ·
  ·
No
Program Function Key 6
  ·
  ·
  ·
Program Function Key 20
pf6
  ·
  ·
  ·
pf20
Yes
·
·
·
Yes
Yes
·
·
·
Yes
Yes
  ·
  ·
  ·
Yes
Program Function Key 21
  ·
  ·
  ·
Program Function Key 24
pf21
  ·
  ·
  ·
pf24
Yes
·
·
·
Yes
Yes
·
·
·
Yes
No
  ·
  ·
  ·
No
Quit quit Yes Yes No
Reset reset Yes Yes No
Response Time Monitor rtm Yes No No
Roll Down roll down No Yes No
Roll Up roll up No Yes No
Rubout rubout Yes Yes Yes
Rule rule Yes Yes Yes
SO/SI Display so si Yes Yes No
SO/SI Generate so si generate No Yes No
System Request sys req Yes Yes No
Tab Field tab field Yes Yes Yes
Tab Word tab word Yes Yes No
Test test request No Yes No
Unmark unmark Yes Yes Yes
Upper case to upper Yes No No
Upper/Lower Change to other Yes No No
Wait for bind wait app Yes Yes No
Wait for System wait sys Yes Yes No
Wait transition wait trn Yes Yes No
Wait while input inh. wait inp inh Yes Yes No
Window Relocation 1
  ·
  ·
  ·
Window Relocation 8
view 1
  ·
  ·
  ·
view 8
Yes
·
·
·
X
Yes
·
·
·
X
Yes
·
·
·
X
VT compose vt compose No No Yes
VT find vt find No No Yes
VT hold screen vt hold No No Yes
VT insert here vt insert No No Yes
VT next screen vt next No No Yes
VT numeric keypad 0 vt numpad 0 No No Yes
VT numeric keypad 1 vt numpad 1 No No Yes
VT numeric keypad 2 vt numpad 2 No No Yes
VT numeric keypad 3 vt numpad 3 No No Yes
VT numeric keypad 4 vt numpad 4 No No Yes
VT numeric keypad 5 vt numpad 5 No No Yes
VT numeric keypad 6 vt numpad 6 No No Yes
VT numeric keypad 7 vt numpad 7 No No Yes
VT numeric keypad 8 vt numpad 8 No No Yes
VT numeric keypad 9 vt numpad 9 No No Yes
VT numeric keypad - vt numpad minus No No Yes
VT numeric keypad , vt numpad comma No No Yes
VT numeric keypad . vt numpad period No No Yes
VT numeric keypad enter vt numpad enter No No Yes
VT PF1 vt pf1 No No Yes
VT PF2 vt pf2 No No Yes
VT PF3 vt pf3 No No Yes
VT PF4 vt pf4 No No Yes
VT prev. screen vt prev No No Yes
VT remove vt remove No No Yes
VT select vt select No No Yes
VT user defined function 6 vt user f6 No No Yes
VT user defined function 7 vt user f7 No No Yes
VT user defined function 8 vt user f8 No No Yes
VT user defined function 9 vt user f9 No No Yes
VT user defined function 10 vt user f10 No No Yes
VT user defined function 11 vt user f11 No No Yes
VT user defined function 12 vt 12 No No Yes
VT user defined function 13 vt user f13 No No Yes
VT user defined function 14 vt user f14 No No Yes
VT user defined function 15 vt user f15 No No Yes
VT user defined function 16 vt user f16 No No Yes
VT user defined function 17 vt user f17 No No Yes
VT user defined function 18 vt user f18 No No Yes
VT user defined function 19 vt user f19 No No Yes
VT user defined function 20 vt user f20 No No Yes
Examples:
  1. To logon
    [SENDKEY("Logon")]
  2. To get reader list
    [SENDKEY("RDRL", enter)]

WAIT Command

[WAIT("[time out][wait condition]")]

Waits until the timeout expires or the wait condition the client specified occurs. For this command, the client has to set at least one option, where:

time out (optional)
If the client sets a timeout value in the command statements, the following units are available in the wait statement.
wait condition (optional)
For the wait condition option, the client can select the following options:
while cursor at (cursor row, cursor column)
While the cursor is at (cursor row, cursor column), it keeps waiting.
while "string"
While the "string" is somewhere on the screen, it keeps waiting.
while "string" at (cursor row, cursor column)
While the "string" is at (cursor row, cursor column) on the screen, it keeps waiting.
until cursor at (cursor row, cursor column)
Until the cursor moves to (cursor row, cursor column), it keeps waiting.
until "string"
Until the "string" is displayed somewhere on the screen, it keeps waiting.
until "string" at (cursor row, cursor column)
Until the "string" is displayed at (cursor row, cursor column), it keeps waiting.

Examples:
  1. To wait 10 seconds
    [WAIT("10 seconds")]
  2. To wait while "ABCDEF" is displayed at (2,9) on the screen
    [WAIT("while ""ABCDEF"" at (2,9)")]
  3. To wait until "ABCDEF" is displayed at (2,9) on the screen, or after 8 seconds
    [WAIT("8 seconds until ""ABCDEF"" at (2,9)")]

Set Cursor Position

3270 5250 VT
Yes Yes Yes

The Set Cursor Position function allows the client application to set the cursor position in the session window.

PostMessage( hServerWnd,
             WM_DDE_POKE,
             hClientWnd,
             PackDDELParam(WW_DDE_POKE,
             hData, aSETCURSOR) );

where:

hData

Identifies a handle to a Windows global memory object that contains the cursor positioning information in the following structure:

typedef struct tagSETCURSOR
{
  unsigned char  poke[(sizeof(DDEPOKE)-1)];
  unsigned short uSetCursorType; /* Cursor Set Type
  unsigned short uSetCursor1;    /* Cursor Row or PS Offset
  unsigned short uSetCursor2;    /* Cursor Col
} SETCURSOR;
 
typedef union tagDDE_SETCURSOR
{
  DDEPOKE    DDEpoke;
  SETCURSOR  DDEsetcursor;
} DDE_SETCURSOR, *lpDDE_SETCURSOR;

Personal Communications supports two ways to set the cursor position:

The application specifies which method by setting the uSetCursorType field to the appropriate value, followed by setting the two other fields uSetCursor1 and uSetCursor2 to their appropriate values as follows:

aSETCURSOR
Identifies cursor position as the item.

Personal Communications Response

Personal Communications receives the cursor information and moves the cursor to the specified position in the PS. If the cursor is positioned successfully, Personal Communications returns a positive ACK message to the client application. Otherwise, a negative ACK message is returned with one of the following error codes in the low-order byte of the wStatus word.

WM_DDE_ACK(wStatus, aSETCURSOR)
Return Code Explanation
1 Cursor set type is not valid. Must be 0 or 1.
2 Cursor PS offset is not valid. Must be 0 ... (PSsize - 1).
3 Cursor row value is not valid. Must be 0 ... (PSrows - 1).
4 Cursor column value is not valid. Must be 0 ... (PScols - 1).
6 The specified format is not valid.
9 A system error occurred.

Set Mouse Intercept Condition

3270 5250 VT
Yes Yes Yes

This function specifies the mouse input to be intercepted. The client sends the following command to set the mouse event to be intercepted.

PostMessage( hServerWnd,
             WM_DDE_POKE,
             hClientWnd,
             PackDDElParam(WM_DDE_POKE,
             hData, aMOUSE) );

where:

hData
Identifies a handle to a Windows global memory object that specifies the condition of intercepting the mouse input.

If the format is CF_TEXT, the client program sends the condition in the following structure:

typedef struct tagSETMOUSE_CF_TEXT
{
  unsigned char poke[(sizeof(DDEPOKE)-1)];
  unsigned char zMouseCondition[1];
} SETMOUSE_CF_TEXT;
 
typedef union tagDDE_SETMOUSE_CF_TEXT
{
  DDEPOKE           DDEpoke;
  SETMOUSE_CF_TEXT  DDEcond;
} DDE_SETMOUSE_CF_TEXT, *lpDDE_SETMOUSE_CF_TEXT;

The following table shows the parameters' values:

Parameter Name Meaning Value
Condition Condition of intercepting the mouse input A string terminated with ‘\0’, consists of the constants defined as follows in any order:
L
Enable intercepting the left button
l
Disable intercepting the left button
R
Enable intercepting the right button
r
Disable intercepting the right button
M
Enable intercepting the middle button
m
Disable intercepting the middle button
S
Enable intercepting a single click
s
Disable intercepting a single click
D
Enable intercepting a double click
d
Disable intercepting a double click
T
Retrieve the pointed string
t
Do not retrieve the pointed string

If the format is CF_DSPTEXT, the client program sends the condition in the following structure:

typedef struct tagSETMOUSE_CF_DSPTEXT
{
  unsigned char poke[(sizeof(DDEPOKE)-1)];
  BOOL          bLeftButton;     /* Enable intercepting left button
  BOOL          bRightButton;    /* Enable intercepting right button
  BOOL          bMiddleButton;   /* Enable intercepting middle button
  BOOL          bSingleClick;    /* Enable intercepting single click
  BOOL          bDoubleClick;    /* Enable intercepting double click
  BOOL          bRetrieveString; /* Enable intercepting retrieve string
} SETMOUSE_CF_DSPTEXT;
 
typedef union tagDDE_SETMOUSE_CF_DSPTEXT
{
  DDEPOKE              DDEpoke;
  SETMOUSE_CF_DSPTEXT  DDEcond;
} DDE_SETMOUSE_CF_DSPTEXT, *lpDDE_SETMOUSE_CF_DSPTEXT;

The following table shows the values in the parameters:

Parameter Name Meaning Value
bLeftButton Enable or disable interception of the left mouse button
True
Enable intercepting the left button
False
Disable intercepting the left button
bRightButton Enable or disable interception of the right mouse button
True
Enable intercepting the right button
False
Disable intercepting the right button
bMiddleButton Enable or disable interception of the middle mouse button
True
Enable intercepting the middle button
False
Disable intercepting the middle button
bSingleClick Enable or disable interception of the single click
True
Enable intercepting the single click
False
Disable intercepting the single click
bDoubleClick Enable or disable interception of the double click
True
Enable intercepting the double click
False
Disable intercepting the double click
bRetrieveString Retrieve or do not retrieve the pointed string
True
Retrieve the pointed string
False
Do not retrieve the pointed string
aMOUSE
Identifies the mouse as the item.

Personal Communications Response

When receiving the Set Mouse Intercept Condition request, Personal Communications returns an ACK message if it can set the intercept condition to the specified status. Otherwise, a negative ACK message is returned to the client with one of the following return codes in the low-order byte of the wStatus field:

WM_DDE_ACK(wStatus, aMOUSE)
Return Code Explanation
2 A character in the Condition parameter is not valid.
6 The specified format is not valid.
9 A system error occurred.

Set Presentation Space Service Condition

3270 5250 VT
Yes Yes Yes

The Set Presentation Space Service Condition function sets the condition for using the following functions:

The client application sets the condition by calling a function such as:

The client must specify the Set Presentation Space Service Condition function before invoking the functions listed above. The conditions set by this function remain in effect until the next Set Presentation Space Service Condition function is called. The client sends the following message to set the condition:

PostMessage( hServerWnd,
             WM_DDE_POKE,
             hClientWnd,
             PackDDELParam(WM_DDE_POKE,
             (hData, aEPSCOND) );

where:

hData

Identifies a handle to a Windows global memory object containing:

typedef struct tagPSSERVCOND
{
  unsigned char  poke[(sizeof(DDEPOKE)-1)];
  unsigned short uPSStart;                    /* PS Position
  unsigned short uPSLength;                   /* Length of String or PS
  unsigned short uSearchDir;                  /* Direction for search
  unsigned short uEOFflag;                    /* EOF effective switch
  unsigned char  szTargetString[1];           /* Target String
} PSSERVCOND;
 
typedef union tagDDE_PSSERVCOND
{
  DDEPOKE     DDEpoke;
  PSSERVCOND  DDEcond;
} DDE_PSSERVCOND, *lpDDE_PSSERVCOND;

The following values are valid at the uSearchDir field:

 PCS_SRCHFRWD    0        /* Search forward.
 PCS_SRCHBKWD    1        /* Search backward.

The following values are valid for the uEOFflag field:

 PCS_UNEFFECTEOF 0   /* The PS Area is not truncated at End of Field (EOF).
 PCS_EFFECTEOF   1   /* The PS Area is truncated at End of Field (EOF).

If the value of uEOFflag is PCS_EFFECTEOF then the PS length and Search Direction are not used.

aEPSCOND
Identifies the item for the Set Presentation Space Service Condition function.

Personal Communications Response

If Personal Communications can perform the Set Presentation Space Service Condition function, then Personal Communications returns an ACK message:

WM_DDE_ACK(wStatus, aEPSCOND)

If Personal Communications cannot perform the Set Presentation Space Service Condition function, then Personal Communications returns a negative ACK message containing the following return codes in the low-order byte of wStatus:

Return Code Explanation
1 PS position is not valid.
2 Length is not valid.
3 The value of EOF flag is not valid.
4 The value of Search Direction is not valid.
6 The specified format is not valid.
9 A system error occurred.

Set Session Advise Condition

3270 5250 VT
Yes Yes Yes

This function sets the condition for the DDE_ADVISE of the Start Session Advise function. The client can specify a search string and a region of the screen. When the advise condition is met, the server notifies the client of the condition according to the options specified by the Start Session Advise function.

Note:
The client must specify the Set Session Advise Condition function before invoking Start Session Advise. If the advise condition is set after the Start Session Advise function is started, the advise condition will be ignored and the client will receive a negative ACK message. See Start Session Advise for more information about starting the advise.

The client sends the following message to set the advise condition.

PostMessage( hServerWnd,
             WM_DDE_POKE,
             hClientWnd,
             PackDDElParam(WM_DDE_POKE,
             (hData, aPSCOND) );

where:

hData
Identifies a handle to a Windows global memory object containing:
typedef struct tagSEARCHDATA
{
  unsigned char  poke[(sizeof(DDEPOKE)-1)];
  unsigned short uPSStart;                  /* PS Position of string
  unsigned short uPSLength;                 /* Length of String
  BOOL           bCaseSensitive;            /* Case Sensitive TRUE=YES
  unsigned char  SearchString[1]; /* Search String
} SEARCHDATA;
 
typedef union tagDDE_SEARCHDATA
{
  DDEPOKE     DDEpoke;
  SEARCHDATA  DDEcond;
} DDE_SEARCHDATA, *lpDDE_SEARCHDATA;
aPSCOND
Identifies the item for the Set Session Advise Condition function.

Personal Communications Response

If Personal Communications can perform the Set Session Advise Condition function, Personal Communications returns this ACK message:

WM_DDE_ACK(wStatus, aPSCOND)

If Personal Communications cannot perform the Set Session Advise Condition function, then Personal Communications returns an negative ACK message containing one of the following return codes in the low-order byte of wStatus:

Return Code Explanation
1 Advise is already active.
2 Advise condition is already active.
3 PS position is not valid.
4 String length is not valid.
6 The specified format is not valid.
9 A system error occurred.

Set Structured Field Service Condition

3270 5250 VT
Yes No No

The Set Structured Field Service Condition function passes the Query Reply data provided by the client application.

Note:
The client must call the Set Structured Field Service Condition function before invoking the Start Read SF function or the Write SF function.

The client sends the following message to set the condition.

PostMessage( hServerWnd,
             WM_DDE_POKE,
             hClientWnd,
             PackDDElParam(WM_DDE_POKE,
             (hData, aSFCOND) );

where:

hData
Identifies a handle to a Windows global memory object containing:
typedef struct tagSFSERVCOND
{
  unsigned char  poke[(sizeof(DDEPOKE)-1)];
  unsigned short uBufferLength;             /* Buffer size of Read_SF
  unsigned short uQRLength;                 /* Length of Query Reply dat
  unsigned char  szQueryReply[1];            /* Query Reply data
} SFSERVCOND;
 
typedef union tagDDE_SFSERVCOND
{
  DDEPOKE     DDEpoke;
  SFSERVCOND  DDEcond;
} DDE_SFSERVCOND, *lpDDE_SFSERVCOND;
aSFCOND
Identifies the item for the Set Structured Field Service Condition function.

PC/3270 Response

PC/3270 checks the Query Reply ID and Type (not DOID) and the length. If they are valid, then PC/3270 returns an ACK message:

WM_DDE_ACK(wStatus, aSFCOND)

If PC/3270 cannot perform the Set Structured Field Service Condition function, then PC/3270 returns a negative ACK message containing one of the following return codes in the low-order byte of wStatus:

Return Code Explanation
1 PS SF ID is not valid.
2 Length is not valid.
3 One DDM base type is already connected to this session.
4 Structured Field Service Condition is already set.
6 The specified format is not valid.
9 A system error occurred.

Start Close Intercept

3270 5250 VT
Yes Yes Yes

The Start Close Intercept function allows a client application to intercept close requests generated when a user selects the close option from the emulator session window. This function intercepts the close request and discards it until the Stop Close Intercept function is requested. After using this function, the client receives DATA messages notifying it that close requests occurred (CLOSE).

The client sends the following command to begin a session advise.

PostMessage( hServerWnd,
             WM_DDE_ADVISE,
             hClientWnd,
             Pack DDElParam(WM_DDE_ADVISE,
             (hOptions, aCLOSE) );

where:

hOptions
Is a handle to a Windows global memory object DDEADVISE structure.

If the value of fDeferUpd is 1, DDE Data messages will be sent to the client application with the hData set to NULL. The client must then issue a DDE REQUEST to request the data item.

If the value of fAckReq is 1, the server does not notify the client of further close requests until the server receives an ACK message from the client in response to any previous notification.

The cfFormat field specifies the format to send the close request. (Must be CF_DSPTEXT.)

aCLOSE
Identifies close intercept as the item.

Personal Communications Response

Personal Communications receives the Start Close Intercept and returns an ACK message if it can start the intercept. Otherwise a negative ACK message is returned to the client with one of the following return codes in the low-order byte of the wStatus field:

WM_DDE_ACK(wStatus, aCLOSE)
Return Code Explanation
1 Close Intercept is already working.
6 The specified format is not valid.
9 A system error occurred.

Once the intercept starts, the client receives DATA messages notifying it that the close request is intercepted:

WM_DDE_DATA(hData, aCLOSE)

where:

hData
Identifies a handle to a Windows global memory object containing:
typedef struct tagCLOSEREQ
{
  unsigned char  data[(sizeof(DDEDATA)-1)];
  unsigned short uCloseReqCount; /* Number of the close requests.
} CLOSEREQ;
 
typedef union tagDDE_CLOSEREQ
{
  DDEDATA   DDEdata;
  CLOSEREQ  DDEclose;
} DDE_CLOSEREQ, *lpDDE_CLOSEREQ;

The DATA messages continue until a Stop Close Intercept message is sent to Personal Communications.

Start Keystroke Intercept

3270 5250 VT
Yes Yes Yes

The Start Keystroke Intercept function allows a client application to filter any keystrokes sent to a session by a terminal operator. After a call to this function, keystrokes are intercepted, and the client receives them (KEYS).

The client sends the following command to begin intercept.

PostMessage( hServerWnd,
             WM_DDE_ADVISE,
             hClientWnd,
             PackDDElParam(WM_DDE_ADVISE,
             (hOptions, aKEYS) );

where:

hOptions
Is a handle to a Windows global memory object DDEADVISE structure.

If the value of fDeferUpd is 1, DDE Data messages are sent to the client application with the hData set to NULL. The client then issues a DDE REQUEST to request the data item.

If the value of fAckReq is 1, the server does not notify the client of further keystrokes until the server receives an ACK message from the client in response to any previous keystrokes notification.

The cfFormat field specifies the format to send the keystrokes when the keystroke is sent by a terminal operator. (Must be CF_DSPTEXT.)

aKEYS
Identifies keystrokes as the item.

Personal Communications Response

Personal Communications receives the Start Keystroke Intercept and returns an ACK message if it can start the intercept. Otherwise a negative ACK message is returned to the client with one of the following return codes in the low-order byte of the wStatus field:

WM_DDE_ACK(wStatus, aKEYS)
Return Code Explanation
1 Keystroke Intercept is already started.
6 The specified format is not valid.
9 A system error occurred.

Once the intercept has started, the client receives DATA messages notifying it that the keystroke is intercepted:

WM_DDE_DATA(hData, aKEYS)

The DATA messages continue until a Stop Keystroke Intercept message is sent to Personal Communications. The format of the data item is the same format as if the client requested the data item via a DDE_REQUEST.

Start Mouse Input Intercept

3270 5250 VT
Yes Yes Yes

The Start Mouse Input Intercept function allows a client application to intercept mouse input when a terminal operator presses the mouse button on an emulator session window. After calling this function, the client receives DATA messages that include the PS position where mouse input occurred.

The client sends the following command to begin to intercept the mouse input.

PostMessage( hServerWnd,
             WM_DDE_ADVISE,
             hClientWnd,
             PackDDElParam(WM_DDE_ADVISE,
             (hOptions, aMOUSE) );

where:

hOptions
Is a handle to a Windows global memory object DDEADVISE structure.

If the value of fDeferUpd is 1, DDE Data messages will be sent to the client application with the hData set to NULL. The client must then issue a DDE REQUEST to request the data item.

If the value of fAckReq is 1, the server does not notify the client of further structured field data until the server receives an ACK message from the client in response to any previous notification.

The cfFormat field specifies the format to send the data item has been updated.

aMOUSE
Identifies the mouse as the item.

Personal Communications Response

Personal Communications receives the Start Mouse Input Intercept and returns an ACK message if it can start this function. Otherwise a negative ACK message is returned to the client with one of the following return codes in the low-order byte of the wStatus field:

WM_DDE_ACK(wStatus, aMOUSE)
Return Code Explanation
1 Mouse Input Intercept has been already started.
6 The specified format is not valid.
9 A system error occurred.

Once the Mouse Input Intercept starts, the client receives DATA messages of the structured field:

WM_DDE_DATA(hData, aMOUSE)

where:

hData

If the format is CF_TEXT, Personal Communications returns the mouse input information in the following format:

typedef struct tagMOUSE_CF_TEXT
{
  unsigned char data[(sizeof(DDEDATA)-1)];
  unsigned char PSPos[4];       /* PS Offset - Mouse position
  unsigned char Tab1[1];        /* Tab character
  unsigned char PSRowPos[4];    /* ROW number of Mouse position
  unsigned char Tab2[1];        /* Tab character
  unsigned char PSColPos[4];    /* Col number of Mouse position
  unsigned char Tab3[1];        /* Tab character
  unsigned char PSSize[4];      /* Size of Presentation Space
  unsigned char Tab4[1];        /* Tab character
  unsigned char PSRows[4[;      /* Row number of PS
  unsigned char Tab5[1];        /* Tab character
  unsigned char PSCols[4];      /* Column number of PS
  unsigned char Tab6[1];        /* Tab character
  unsigned char Button[1];      /* Type of clicked mouse butt n
  unsigned char Tab7[1];        /* Tab character
  unsigned char Click[1];       /* Type of clicking
  unsigned char Tab8[1];        /* Tab character
  unsigned char zClickString[1];/* Retrieved string
} MOUSE_CF_TEXT;
 
typedef union tagDDE_MOUSE_CF_TEXT
{
  DDEDATA        DDEdata;
  MOUSE_CF_TEXT  DDEmouse;
} DDE_MOUSE_CF_TEXT, *lpDDE_MOUSE_CF_TEXT;

The following table shows the values in the parameters:

Parameter Name Meaning Value
PSPos PS offset of the position where mouse was clicked 0 ... (PSSize - 1)
PSRowPos Row number of the position where mouse was clicked 0 ... (PSRows - 1)
PSColPos Column number of the position where mouse was clicked 0 ... (PSCols - 1)
PSSize Presentation space size
PSRows Number of presentation space rows
PSCols Number of presentation space columns
ButtonType Type of clicked mouse button
L
Left button
M
Middle button
R
Right button
ClickType Type of clicking
S
Single click
D
Double click
ClickString Retrieved string to which the mouse pointed A character string terminated with a ‘\0’
Tab1-8 A tab character for delimiter ‘\t’

If the format is CF_DSPTEXT, Personal Communications returns the mouse input information in the following format:

typedef struct tagMOUSE_CF_DSPTEXT
{
  unsigned char  data[(sizeof(DDEDATA)-1)];
  unsigned short uPSPos;                  /* PS Offset  - Mouse position
  unsigned short uPSRowPos;               /* ROW number - Mouse position
  unsigned short uPSColPos;               /* Col number - Mouse position
  unsigned short uPSSize;                 /* Size of Presentation Space
  unsigned short uPSRows;                 /* Row number of PS
  unsigned short uPSCols;                 /* Column number of PS
  unsigned short uButtonType;             /* Type of clicked mouse button
  unsigned short uClickType;              /* Type of clicking
  unsigned char  zClickString[1];          /* Retrieved string
} MOUSE_CF_DSPTEXT;
 
typedef union tagDDE_MOUSE_CF_DSPTEXT
{
  DDEDATA           DDEdata;
  MOUSE_CF_DSPTEXT  DDEmouse;
} DDE_MOUSE_CF_DSPTEXT, *lpDDE_MOUSE_CF_DSPTEXT;

The following table shows the values in the parameters:

Parameter Name Meaning Value
uPSPos PS offset of the position where the mouse was clicked 0 ... (uPSSize - 1)
uPSRowPos Row number of the position where the mouse was clicked 0 ... (uPSRows - 1)
uPSColPos Column number of the position where the mouse was clicked 0 ... (uPSCols - 1)
uPSSize Size of the presentation space
uPSRows Number of rows of the presentation space
uPSCols Number of columns of the presentation space
uButtonType Type of the clicked mouse button
0x0001
Left button
0x0002
Middle button
0x0003
Right button
uClickType Type of clicking
0x0001
Single click
0x0002
Double click
szClickString Retrieved string to which the mouse pointed A character string terminated with a ‘\0’

The DATA messages continue until a Stop Mouse Input Intercept message is sent to Personal Communications.

Start Read SF

3270 5250 VT
Yes No No

The Start Read SF function allows a client application to read structured field data from the host application. After using this function, the client receives DATA messages notifying it that close requests occurred.

Note:
Before using this function, the client must call the Set Structured Field Service Condition function to pass the Query Reply data to the server.

The client sends the following command to begin a Read SF.

PostMessage( hServerWnd,
             WM_DDE_ADVISE,
             hClientWnd,
             PackDDElParam(WM_DDE_ADVISE,
             (hOptions, aSF) );

where:

hOptions
Is a handle to a Windows global memory object DDEADVISE structure.

If the value of fDeferUpd is 1, DDE Data messages will be sent to the client application with the hData set to NULL. The client must then issue a DDE REQUEST to request the data item.

If the value of fAckReq is 1, the server does not notify the client of further structured field data until the server receives an ACK message from the client in response to any previous notification.

The cfFormat field specifies the format to send the structured field data. (It must be CF_DSPTEXT.)

aSF
Identifies structured field as the item.

PC/3270 Response

PC/3270 receives the Start Read SF and returns an ACK message if it can start the Read SF. Otherwise a negative ACK message is returned to the client with one of the following return codes in the low-order byte of the wStatus field:

WM_DDE_ACK(wStatus, aSF)

Return Code Explanation
1 Read SF is already started.
3 No prior Set Structured Field Service Condition function was called.
6 The specified format is not valid.
9 A system error occurred.

Once the Read SF has started, the client receives DATA messages of the structured field:

WM_DDE_DATA(hData, aSF)

where:

hData
Identifies a handle to a Windows global memory object containing:
typedef struct tagMOUSE_CF_DSPTEXT
{
  unsigned char  data[(sizeof(DDEDATA)-1)];
  unsigned short uPSPos;                  /* PS Offset  - Mouse position
  unsigned short uPSRowPos;               /* ROW number - Mouse position
  unsigned short uPSColPos;               /* Col number - Mouse position
  unsigned short uPSSize;                 /* Size of Presentation Space
  unsigned short uPSRows;                 /* Row number of PS
  unsigned short uPSCols;                 /* Column number of PS
  unsigned short uButtonType;             /* Type of clicked mouse button
  unsigned short uClickType;              /* Type of clicking
  unsigned char  zClickString[1];          /* Retrieved string
} MOUSE_CF_DSPTEXT;
 
typedef union tagDDE_MOUSE_CF_DSPTEXT
{
  DDEDATA           DDEdata;
  MOUSE_CF_DSPTEXT  DDEmouse;
} DDE_MOUSE_CF_DSPTEXT, *lpDDE_MOUSE_CF_DSPTEXT;
typedef struct tagSFDATA
{
  unsigned char  data[(sizeof(DDEDATA)-1)];
  unsigned short uSFLength;                /* Length of SF data
  unsigned char  szSFData[1];               /* SF data
} SFDATA;
 
typedef union tagDDE_SFDATA
{
  DDEDATA  DDEdata;
  SFDATA   DDEsfdata;
} DDE_SFDATA, *lpDDE_SFDATA;

The DATA messages continue until a Stop Read SF message is sent to PC/3270.

Start Session Advise

3270 5250 VT
Yes Yes Yes

The Start Session Advise function establishes a link between the Personal Communications session and the client. This lets the client receive updates of the presentation space (PS), the operator information area (OIA), or the trim rectangle (TRIMRECT) when the data item is updated.

Note:
If the client application needs conditional notification when the presentation space is updated, set an advise condition prior to invoking the advise function for the presentation space. See Set Session Advise Condition.

The client sends the following command to begin a session advise.

PostMessage( hServerWnd,
             WM_DDE_ADVISE,
             hClientWnd,
             PackDDElParam(WM_DDE_ADVISE,
             hOptions, aItem) );

where:

hOptions
Is a handle to a Windows global memory object DDEADVISE structure. This is the structure:
typedef struct tagDDEADVISE
{
 unsigned reserved:14;        // Reserved
 unsigned fDeferUpd:1;        // Send notification only
 unsigned fAckReq:1;          // Client will ACK all notices
 WORD     cfFormat;           // Clipboard format to use
}  DDEADVISE, *lpDDEADVISE;

If the value of fDeferUpd is 1, DDE Data messages are sent to the client application with the hData set to NULL. The client must then issue a DDE REQUEST to request the data item.

If the value of fAckReq is 1, the server does not notify the client of further changes to the data item until the server receives an ACK message from the client in response to any previous update notification.

The cfFormat field specifies the format to send the data item when the item has been updated.

aItem
Specifies the item of information being requested; in this case, the value can be PS, OIA, or TRIMRECT.

Personal Communications Response

Personal Communications receives the Start Session Advise and returns an ACK message if it can start the advise. Otherwise, a negative ACK message is returned to the client with one of the following return codes in the low-order byte of the wStatus field:

WM_DDE_ACK(wStatus, aItem)

Return Code Explanation
1 Advise already active for data item.
6 Advise parameter not valid.
9 A system error occurred.

Once the advise has started, the client receives DATA messages notifying it that the data item (PS, OIA, or TRIMRECT) has changed:

WM_DDE_DATA(hData, aItem)

The DATA messages continue until a Stop Session Advise message is sent to Personal Communications. The format of the data item is the same as if the client requested the data item via a DDE_REQUEST.

Stop Close Intercept

3270 5250 VT
Yes Yes Yes

The Stop Close Intercept function ends a client application's ability to intercept close requests. The client sends the following command to perform the Stop Close Intercept function.

PostMessage( hServerWnd,
             WM_DDE_UNADVISE,
             hClientWnd,
             MAKELPARAM(NULL, aCLOSE) );

where:

aCLOSE
Identifies close intercept as the item.

Personal Communications Response

If Personal Communications can perform the DDE_UNADVISE, Personal Communications returns an ACK message containing positive status information to the client:

WM_DDE_ACK(wStatus, aCLOSE)

If Personal Communications cannot perform the DDE_UNADVISE, Personal Communications returns an ACK message containing negative status information and one of the following return codes in the low-order byte of the wStatus word:

Return Code Explanation
1 Advise has not started yet.
9 A system error occurred.

Stop Keystroke Intercept

3270 5250 VT
Yes Yes Yes

The Stop Keystroke Intercept function ends a client application’s ability to intercept keystrokes. The client sends the following command to perform the Stop Keystroke Intercept function.

PostMessage( hServerWnd,
             WM_DDE_UNADVISE,
             hClientWnd,
             MAKELPARAM(NULL, aKEYS) );

where:

aKEYS
Identifies keystrokes as the item.

Personal Communications Response

If Personal Communications can perform the DDE_UNADVISE, Personal Communications returns an ACK message containing positive status information to the client:

WM_DDE_ACK(wStatus, aKEYS)

If Personal Communications cannot perform the DDE_UNADVISE, Personal Communications returns an ACK message containing negative status information and one of the following return codes in the low-order byte of the wStatus word.

Return Code Explanation
1 Advise has not started yet.
9 A system error occurred.

Stop Mouse Input Intercept

3270 5250 VT
Yes Yes Yes

The Stop Mouse Input Intercept function ends a client application’s ability to intercept mouse input.

The client sends the following command to perform the Stop Mouse Input Intercept function.

PostMessage( hServerWnd,
             WM_DDE_UNADVISE,
             hClientWnd,
             MAKELPARAM(NULL, aMOUSE) );

where:

aMOUSE
Identifies the mouse as the item.

Personal Communications Response

If Personal Communications can perform the DDE_UNADVISE, Personal Communications returns an ACK message containing positive status information to the client:

WM_DDE_ACK(wStatus, aMOUSE)

If Personal Communications cannot perform the DDE_UNADVISE, Personal Communications returns an ACK message containing negative status information and one of the following return codes in the low-order byte of the wStatus word.

Return Code Explanation
1 Advise has not started yet.
9 A system error occurred.

Stop Read SF

3270 5250 VT
Yes No No

The Stop Read SF function ends a client application’s ability to read structured field data.

The client sends the following command to perform the Stop Read SF function.

PostMessage( hServerWnd,
             WM_DDE_UNADVISE,
             hClientWnd,
             MAKELPARAM(NULL, aSF) );

where:

aSF
Identified structured field as the item.

PC/3270 response

If PC/3270 can perform the DDE_UNADVISE, PC/3270 returns an ACK message containing positive status information to the client:

WM_DDE_ACK(wStatus, aSF)

If PC/3270 cannot perform the DDE_UNADVISE, PC/3270 returns an ACK message containing negative status information and one of the following return codes in the low-order byte of the wStatus word.

Return Code Explanation
1 Advise has not started yet.
9 A system error occurred.

Stop Session Advise

3270 5250 VT
Yes Yes Yes

The Stop Session Advise function disconnects a link between Personal Communications and the client. The client sends the following command to perform the Stop Session Advise function.

PostMessage( hServerWnd,
             WM_DDE_UNADVISE,
             hClientWnd,
             MAKELPARAM(NULL, aItem) );

where:

aItem
Specifies the item of information being requested; in this case, the value can be PS, OIA, TRIMRECT, or NULL.

If the value of aItem is NULL, then the client has requested termination of all active notifications for the conversation.

Personal Communications Response

If Personal Communications can perform the DDE_UNADVISE, Personal Communications returns an ACK message containing positive status information to the client:

WM_DDE_ACK(wStatus, aItem)

If Personal Communications cannot perform the DDE_UNADVISE, Personal Communications returns an ACK message containing negative status information and one of the following return codes in the low-order byte of the wStatus word.

Return Code Explanation
1 Advise has not started yet.
9 A system error occurred.

Terminate Session Conversation

3270 5250 VT
Yes Yes Yes

The Terminate Session Conversation function disconnects the client from the Personal Communications session the client has previously started a conversation with.

The client sends the following command to terminate a session conversation.

SendMessage( hServerWnd,
             WM_DDE_TERMINATE,
             hClientWnd,
             0 );

Personal Communications Response

Personal Communications acknowledges the terminate command with a terminate message:

WM_DDE_TERMINATE

Terminate Structured Field Conversation

3270 5250 VT
Yes No No

The Terminate Structured Field Conversation function disconnects the client from a structured field conversation.

The client sends the following command to terminate a structured field conversation.

SendMessage( hServerWnd,
             WM_DDE_TERMINATE,
             hClientWnd,
             0 );

PC/3270 Response

PC/3270 acknowledges the terminate command with a terminate message:

WM_DDE_TERMINATE

Terminate System Conversation

3270 5250 VT
Yes Yes Yes

This disconnects the client from a system conversation.

The client sends the following command to terminate a system conversation.

SendMessage( hServerWnd,
             WM_DDE_TERMINATE,
             hClientWnd,
             0 );

Personal Communications Response

Personal Communications acknowledges the terminate command with this message:

WM_DDE_TERMINATE

When the user closes a Personal Communications session, any global memory blocks that were allocated by Personal Communications will be freed by Windows. This can cause problems for the client if the client retains any of these global memory objects for long periods of time. If the client application needs to keep the information in a global memory item for a long time, it is suggested that the client make a copy of global memory item into a global memory item the client application owns.

Write SF

3270 5250 VT
Yes No No

The Write SF function allows a client application to write structured field data to the host application.

Note:
The client must call the Set Structured Field Service Condition function before invoking the Write SF function.

The client sends the following message to write structured field data.

PostMessage( hServerWnd,
             WM_DDE_POKE,
             hClientWnd,
             PackDDELParam(WM_DDE_POKE,
             hData, aSF) );

where:

hData
Identifies a handle to a Windows global memory object containing:
typedef struct tagWRITESF
{
  unsigned char  poke[(sizeof(DDEPOKE)-1)];
  unsigned short uSFLength;      /* Length of SF data
  unsigned char  Work[8];        /* Work area
  unsigned char  szSFData[1];    /* SF data
} WRITESF;
 
typedef union tagDDE_WRITESF
{
  DDEPOKE  DDEpoke;
  WRITESF  DDEwritesf;
} DDE_WRITESF, *lpDDE_WRITESF;
aSF
Identifies structured field as the item.

PC/3270 Response

PC/3270 receives structured field data and sends it to the host application. If the data transmission completes successfully, then PC/3270 returns an ACK message:

WM_DDE_ACK(wStatus, aSF)

Otherwise PC/3270 returns an negative ACK message containing one of the following return codes in the low-order byte of wStatus:

Return Code Explanation
2 Length is not valid.
6 The specified format is not valid.
9 A system error occurred.

DDE Menu Item API in a Windows 32-Bit Environment

Personal Communications supports the addition, deletion, and changing of attributes of a dynamic menu item to the session menu bar. A menu will then be created for this menu item with space for up to 16 submenu items.

Personal Communications supports two kinds of DDE conversation. One is Personal Communications, which acts as a DDE menu client application, and the other is Personal Communications, which acts as a DDE menu server.

DDE Menu Client

To add, delete, and change menu items, the following DDE conversation must take place between the session and DDE menu server application.

Figure 3. DDE Menu Server Conversation
REQTEXT

The following data hierarchy details the menu map Personal Communications expects when adding a dynamic menu item and submenu to a session menu bar:

 
   POPUP  "MyMenu"
   BEGIN
     MENUITEM "Send Files to Host",        SEND
     MENUITEM "Receive Files from Host",   RECEIVE
     MENUITEM SEPARATOR
     MENUITEM "Convert Files",             CONVERT
   END

When the user selects a menu item from the new menu, Personal Communications will send a DDE Initiate with 3270MenuN or 5250MenuN as the application and itemN token as the topic. If an ACK is received from the DDE application, Personal Communications will inhibit the session from accepting user input. The menu client application can then display a dialog, and so on. When the menu server application has completed processing of the menu item, it will send a DDE Terminate to signal Personal Communications the process is complete. Personal Communications will then reenable the window for the user.

DDE Menu Server

To add, delete, and change menu items, the following DDE conversation must take place between the session and a DDE menu client application.

Figure 4. DDE Menu Client Conversation
REQTEXT

When the user selects a menu item from the new menu, Personal Communications will send a DDE DATA with aSELECTMENU as the item. When Personal Communications sends DDE DATA to the client application, Personal Communications will inhibit the session from accepting user input. The menu client application can then display a dialog, and so on. When the menu client application has completed processing of the menu item, it will send a DDE ACK to signal Personal Communications the process is complete. Personal Communications will then reenable the window for the user.

DDE Menu Functions

The DDE Menu Item API functions listed below are available for use with Personal Communications. PC/3270 Windows mode and PC400 provide all of the following functions.

Change Menu Item

3270 5250 VT
Yes Yes Yes

The Change Menu Item function appends, deletes, inserts, modifies, and removes menu items. The client sends the following message to the session to change a menu.

PostMessage( hServerWnd,
             WM_DDE_POKE,
             hClientWnd,
             PackDDElParam(WM_DDE_POKE,
             hData,aCHANGEMENU));

where:

hData

Identifies a handle to a Windows global memory object that contains the requests for changing a menu. The global memory object contains the following structure:

typedef struct tagChangeMenu
{
  unsigned char  poke[(sizeof(DDEPOKE)-1)];
  HWND           hMenu;                    /* Window handle of menu item
  unsigned long  wIDNew;                   /* Menu ID of new menu item
  unsigned short wPosition;                /* The position of menu item
  unsigned short wOperation;               /* Specifies the operation
  unsigned short wFlags;                   /* Specifies the options
  unsigned char  szItemName[1];  /* String of the item
} CHANGEMENU;
 
typedef union tagDDE_CHANGEMENU
{
  DDEPOKE     DDEpoke;
  CHANGEMENU  DDEmenu;
} DDE_CHANGEMENU,*lpDDE_CHANGEMENU;

The following operations are supported:

# MF_APPEND,MF_CHANGE ... MF_BYCOMMANDS are replaced with below commands.
 PCS_INSERT       0x0000   /* Inserts a menu item into a menu.
 PCS_CHANGE       0x0080   /* Modifies a menu item in a menu.
 PCS_APPEND       0x0100   /* Appends a menu item to the end of a menu
 PCS_DELETE       0x0200   /* Deletes a menu item from a menu,
                           /* destroying the menu item.
 PCS_REMOVE       0x1000   /* Removes a menu item from a menu but
                           /* does not destroy the menu item.
 
 PCS_CHECKED      0x0008   /* Places a check mark next to the item.
 PCS_DISABLED     0x0002   /* Disables the menu item so that it cannot
                           /* be selected, but does not gray it.
 PCS_ENABLED      0x0000   /* Enables the menu item so that it can be
                           /* selected and restores from its grayed
                           /* state.
 PCS_GRAYED       0x0001   /* Disables the menu item so that it cannot
                           /* be selected, and grays it.
 PCS_MENUBARBREAK 0x0020   /* Same as PCS_MENUBREAK except that for
                           /* popup menus, separates the new column
                           /* from the old column with a vertical line
 PCS_MENUBREAK    0x0040   /* Places the item on a new line for menu
                           /* bar items. For popup menus, places the
                           /* item in a new column, with no dividing
                           /* line between the columns.
 PCS_SEPARATOR    0x0800   /* Draws a horizontal dividing line. Can
                           /* only be used in a popup menu. This line
                           /* cannot be grayed, disabled, or
                           /* highlighted. The wIDNew and szItemName
                           /* fields are ignored.
 PCS_UNCHAKED     0x0000   /* Does not place a check mark next to the
                           /* item (default).
 
 PCS_BYCOMMAND    0x0000   /* Specifies that the nPosition parameter
                           /* gives the menu item control ID number.
                           /* This is the default if neither item
                           /* control ID number. This is the default
                           /* if neither PCS_BYCOMMAND nor
                           /* PCS_POSITION is set.
 PCS_BYPOSITION   0x0400   /* Specifies that the nPosition parameter
                           /* gives the position of the menu item
                           /* to be deleted rather than an ID number.

If the MF_APPEND is specified in the wOperation field, the following fields must be filled:

hMenu

Identifies the menu to be appended. To append a new item to a pop-up menu, specify the handle that is returned from Personal Communications when the Create Menu Item function is executed. To append a new item to a top-level menu bar, specify NULL.

wIDNew

Specifies the command ID of the new menu item. If a new item is added to the top-level menu bar, the handle of the menu item returned from Personal Communications when Create Menu Item function is executed.

wFlags

The following options can be set:

MF_CHECKED       // Places a check mark next to
                 // the item.
MF_DISABLED      // Disables the menu item so
                 // that it cannot be selected,
                 // but does not gray it.
MF_ENABLED       // Enables the menu item so that
                 // it can be selected and
                 // restores from its grayed
                 // state.
MF_GRAYED        // Disables the menu item so
                 // that it cannot be selected,
                 // and grays it.
MF_MENUBARBREAK  // Same as MF_MENUBREAK except
                 // that for pop-up menus,
                 // separates the new column from
                 // the old column with a
                 // vertical line.
MF_MENUBREAK     // Places the item on a new line
                 // for menu bar items.
                 // For pop-up menus, places the
                 // item in a new column, with
                 // no dividing line between the
                 // columns.
MF_SEPARATOR     // Draws a horizontal dividing
                 // line.  Can only be used in a
                 // pop-up menu.  This line cannot
                 // be grayed, disabled, or
                 // highlighted.  The wIDNew and
                 // szItemName fields are
                 // ignored.
MF_UNCHECKED     // Does not place a check mark
                 // next to the item (default).
szItemName

Specifies the contents of the new menu item. Contains a null-terminated character string.

If the MF_CHANGE is specified in the wOperation field, fill these fields:

hMenu

Identifies the menu to be changed. To change an item of a pop-up menu, specify the handle that is returned from Personal Communications when the Create Menu Item function is executed. To change an item to a top-level menu bar, specify NULL.

nPosition

Specifies the menu item to be changed. The interpretation of the wPosition parameter depends on the setting of the wFlags parameter.

MF_BYPOSITION
Specifies the position of the existing menu item. The first item in the menu is at position zero.
MF_BYCOMMAND
Specifies the command ID of the existing menu item.
wIDNew

Specifies the command ID of the menu item. If an item of the top-level menu bar is changed, the handle of the menu item returned from Personal Communications when the Create Menu Item function is executed.

wFlags

The following options can be set:

MF_BYCOMMAND     // Specifies that the nPosition
                 // parameter gives the menu
                 // item control ID number.
                 // This is the default if
                 // neither MF_BYCOMMAND nor
                 // MF_BYPOSITION is set.
MF_BYPOSITION    // Specifies that the nPosition
                 // parameter gives the position
                 // of the menu item to be
                 // changed rather than an ID
                 // number.
MF_CHECKED       // Places a check mark next to
                 // the item.
MF_DISABLED      // Disables the menu item so
                 // that it cannot be selected,
                 // but does not gray it.
MF_ENABLED       // Enables the menu item so
                 // that it can be selected and
                 // restores from its grayed
                 // state.
MF_GRAYED        // Disables the menu item so
                 // that it cannot be selected,
                 // and grays it.
MF_MENUBARBREAK  // Same as MF_MENUBREAK except
                 // that for pop-up menus,
                 // separates the new column
                 // from the old column with a
                 // vertical line.
MF_MENUBREAK     // Places the item on a new
                 // line for menu bar items.
                 // For pop-up menus, places the
                 // item in a new column, with
                 // no dividing line between
                 // the columns.
MF_SEPARATOR     // Draws a horizontal dividing
                 // line.  Can only be used in
                 // a pop-up menu.  This line
                 // cannot be grayed, disabled,
                 // or highlighted.  The wIDNew
                 // and szItemName fields are
                 // ignored.
MF_UNCHECKED     // Does not place a check mark
                 // next to the item (default).
szItemName

Specifies the contents of the menu item. Contains a null-terminated character string.

If the MF_DELETE is specified in the wOperation field, fill these fields:

hMenu

Identifies the menu to be deleted. To delete an item from a pop-up menu, specify the handle that is returned from Personal Communications when the Create Menu Item, function is executed. To delete an item from a top-level menu bar, specify NULL.

nPosition

Specifies the menu item to be deleted. The interpretation of the nPosition parameter depends on the setting of the wFlags parameter.

MF_BYPOSITION
Specifies the position of the existing menu item. The first item in the menu is at position zero.
MF_BYCOMMAND
Specifies the command ID of the existing menu item.
wFlags

The following options can be set:

MF_BYCOMMAND     // Specifies that the nPosition
                 // parameter gives the menu
                 // item control ID number.
                 // This is the default if
                 // neither MF_BYCOMMAND nor
                 // MF_BYPOSITION is set.
MF_BYPOSITION    // Specifies that the nPosition
                 // parameter gives the position
                 // of the menu item to be
                 // deleted rather than an ID
                 // number.

If the MF_INSERT is specified in the wOperation field, the following fields must be filled:

hMenu

Identifies the menu to be inserted. To insert an item to a pop-up menu, specify the handle that is returned from Personal Communications when the Create Menu Item function is executed. To change an item to a top-level menu bar, specify NULL.

nPosition

Specifies the menu item before the new menu item is to be inserted. The interpretation of the nPosition parameter depends on the setting of the wFlags parameter.

MF_BYPOSITION
Specifies the position of the existing menu item. The first item in the menu is at position zero.
MF_BYCOMMAND
Specifies the command ID of the existing menu item.
wIDNew

Specifies the command ID of the menu item or, if an item of the top-level menu bar is changed, the handle of the menu item returned from Personal Communications when the Create Menu Item function is executed.

wFlags

The following options can be set:

MF_BYCOMMAND         // Specifies that the nPosition
                    // parameter gives the menu
                    // item control ID number. This
                    // is the default if neither
                    // MF_BYCOMMAND nor MF_BYPOSITION
                    // is set.
MF_BYPOSITION        // Specifies that the nPosition
                    // parameter gives the position
                    // of the menu item to be
                    // changed rather than an ID
                    // number.
MF_CHECKED           // Places a check mark next to
                    // the item.
MF_DISABLED          // Disables the menu item so
                    // that it cannot be selected,
                    // but does not gray it.
MF_ENABLED           // Enables the menu item so
                    // that it can be selected and
                    // restores from its grayed
                    // state.
MF_GRAYED            // Disables the menu item so
                    // that it cannot be selected,
                    // and grays it.
MF_MENUBARBREAK      // Same as MF_MENUBREAK except
                    // that for pop-up menus,
                    // separates the new column
                    // from the old column with a
                    // vertical line.
MF_MENUBREAK         // Places the item on a new
                    // line for menu bar items.
                    // For pop-up menus, places the
                    // item in a new column, with
                    // no dividing line between the
                    // columns.
MF_SEPARATOR         // Draws a horizontal dividing
                    // line.  Can only be used in
                    // a pop-up menu.  This line
                    // cannot be grayed, disabled,
                    // or highlighted. The wIDNew
                    // and szItemName fields are
                    // ignored.
MF_UNCHECKED         // Does not place a check mark
                    // next to the item (default).
szItemName

Specifies the contents of the menu item. Contains a null-terminated character string.

If the MF_REMOVE is specified in the wOperation field, the following fields must be filled:

hMenu

Identifies the menu to be removed. To remove an item from a pop-up menu, specify the handle that is returned from Personal Communications when the Create Menu Item function is executed. To remove an item from a top-level menu bar, specify NULL.

nPosition

Specifies the menu item to be removed. The interpretation of the nPosition parameter depends upon the setting of the wFlags parameter.

MF_BYPOSITION
Specifies the position of the existing menu item. The first item in the menu is at position zero.
MF_BYCOMMAND
Specifies the command ID of the existing menu item.
wFlags

The following options can be set:

MF_BYCOMMAND         // Specifies that the nPosition
                    // parameter gives the menu
                    // item control ID number.
                    // This is the default if
                    // neither MF_BYCOMMAND nor
                    // MF_BYPOSITION is set.
MF_BYPOSITION        // Specifies that the nPosition
                    // parameter gives the
                    // position of the menu item to
                    // be removed rather than an ID
                    // number.

Personal Communications Response

Personal Communications receives the requests to change a menu and processes them. If the requests cannot be accepted, Personal Communications returns a negative ACK message containing one of the following status codes in the low-order byte of the wStatus word. Otherwise, Personal Communications returns a positive ACK message signalling that the keystrokes have been sent.

WM_DDE_ACK(wStatus,aCHANGEMENU)

Return code Explanation
1 The specified parameters are not valid.
6 The specified format is not valid.
9 A system error occurred.

Create Menu Item

3270 5250 VT
Yes Yes Yes

The Create Menu Item function requests Personal Communications to add a menu item to the menu bar. A pop-up menu will be created at the same time, but it is initially empty and can be filled with menu items by using this function. The string of the new menu item that will be added to a top-level menu bar, is also specified by using the Change Menu Item function.

The client sends the following message to create a menu item.

PostMessage( hServerWnd,
             WM_DDE_REQUEST,
             hClientWnd,
             MAKELPARAM(cfFormat,aCREATEMENU));

where:

cfFormat

Identifies the format for the ID of the new menu item. The valid value is CF_DSPTEXT.

aCREATEMENU

Identifies the create menu item.

Personal Communications Response

Personal Communications returns the handle of the newly created menu item in a DDE data message if the Personal Communications can create a menu item.

WM_DDE_DATA(hData,aCREATEMENU)

where:

hData

Identifies a handle to a windows global memory object that contains the handle of the menu item. The global memory object contains the following structure:

typedef struct tagCreateMenu
{
  unsigned char    data[(sizeof(DDEDATA)-1)];
  HWND             hMemuItem;     /* Handle of the menu item
} CREATEMENU;
 
typedef union tagDDE_CREATEMENU
{
  DDEDATA     DDEdata;
  CREATEMENU  DDEmenu;
} DDE_CREATEMENU,*lpDDE_CREATEMENU;

or

WM_DDE_ACK(wStatus,aCREATEMENU)

If Personal Communications cannot create a menu item, one of the following status codes is returned in the low-order byte of the wStatus word:

Return Code Explanation
6 The specified format is not valid.
9 A system error occurred.

Initiate Menu Conversation

3270 5250 VT
Yes Yes Yes

The Initiate Menu Conversation function connects a client application to an available session of Personal Communications. Once a menu conversation is established, the session menu is reserved exclusively for the client until the conversation is terminated.

The client application sends the following message to initiate a DDE conversation with a menu:

SendMessage( -1,
             WM_DDE_INITIATE,
             hClientWnd,
             MAKELPARAM(aIBM327032,SN));

where:

aIBM327032

Identifies the application atom. The string used to create atom aIBM327032 is IBM327032. In the PC400, the application atom is aIBM525032 and the string IBM525032 is used to create it.

SN

Identifies the topic atom. The string used to create atom a3270MenuSN is 3270MenuS appended with the session ID A, B, ..., Z. In the PC400, the topic atom is a5250MenuSN and the string 5250MenuS appended with the session ID A, B, ..., Z. is used to create it.

Personal Communications Response

If Personal Communications can support a conversation with the client application, Personal Communications acknowledges the INITIATE transaction with:

WM_DDE_ACK(aIBM327032,SN)

Start Menu Advise

3270 5250 VT
Yes Yes Yes

The Start Menu Advise function allows a client application to process a user defined routine when the menu item that is added by the client application, is selected. After using this function, the client receives DATA messages indicating which menu item is selected.

The client sends the following command to begin a menu advise.

PostMessage( hServerWnd,
             WM_DDE_ADVISE,
             hClientWnd,
             PackDDElParam(WM_DDE_ADVISE,
             hOptions,aSELECTMENU));

where:

hOptions

Is a handle to a Windows global memory object with the following structure:

typedef struct tagOPTIONS
{
 unsigned reserved:14;       // Reserved
 unsigned fDeferUpd:1;       // Send notification only
                             // (Must be 0)
 unsigned fAckReq:1;         // Client will ACK all notices
                             // (Must be 1)
 WORD     cfFormat;          // Always CF_DSPTEXT
}  OPTIONS,FAR *lpOPTIONS;
aSELECTMENU

Identifies a menu advise as the item.

Personal Communications Response

Personal Communications receives the Start Menu Advise and returns an ACK message if it can start the function. Otherwise, a negative ACK message is returned to the client with one of the following return codes in the low-order byte of the wStatus field.

Return Code Explanation
1 Menu Advise has been already started.
6 The specified format is not valid.
9 A system error occurred.
WM_DDE_ACK(wStatus,aSELECTMENU)

Once the menu item (added to the client application) is selected, the client receives DATA messages notifying it which menu item is selected:

WM_DDE_DATA(hData,aSELECTMENU)

where:

hData

Identifies a handle to a Windows global memory object containing:

typedef struct tagSELECTMENU
{
  unsigned char  data[(sizeof(DDEDATA)-1)];
  unsigned short uIDSelected; /* Command ID of the selected menu item
} SELECTMENU;
 
typedef union tagDDE_SELECTMENU
{
  DDEDATA     DDEdata;
  SELECTMENU  DDEmenu;
} DDE_SELECTMENU,*lpDDE_SELECTMENU;

The DATA messages continue until a Stop Menu Advise message is sent to Personal Communications.

Stop Menu Advise

3270 5250 VT
Yes Yes Yes

The Stop Menu Advise function ends a client application’s ability to process a user-defined routine when the menu item added by the client application is selected. The client sends the following command to perform the Stop Menu Advise function.

PostMessage( hServerWnd,
             WM_DDE_UNADVISE,
             hClientWnd,
             MAKELPARAM(NULL,aSELECTMENU));

where:

aSELECTMENU

Identifies a menu advise as the item.

Personal Communications Response

If Personal Communications can perform the DDE_UNADVISE, Personal Communications returns an ACK message containing positive status information to the client:

WM_DDE_ACK(wStatus,aCLOSE)

If Personal Communications cannot perform the DDE_UNADVISE, Personal Communications returns an ACK message containing negative status information and one of the following return codes in the low-order byte of the wStatus word:

Return Code Explanation
1 Advise has not started yet.
9 A system error occurred.

Terminate Menu Conversation

3270 5250 VT
Yes Yes Yes

The Terminate Menu Conversation function disconnects the client from the Personal Communications session with which a conversation had been previously started.

The client sends the following command to terminate a session conversation:

SendMessage( hServerWnd,
             WM_DDE_TERMINATE,
             hClientWnd,
             0 );

Personal Communications Response

Personal Communications acknowledges the terminate command with this message:

WM_DDE_TERMINATE

Summary of DDE Functions in a Windows 32-Bit Environment

The following table lists the DDE functions that can be used with PC/3270 or PC400. The table lists the name of the DDE function, the command the client sends to PC/3270 or PC400, the values that can be used for the variables in the client command, and the server response.

Table 20. DDE Function Summary
Function Name Client Command Server Response
Code Conversion (system)
PostMessage(hServerWnd
  WM_DDE_POKE,
  hClientWnd,
  PackDDEIParam(WM_DDE_POKE,hData,
  aCONV));
UnPackDDElParam(WM_DDE_ACK,wStatus,aCONV)
Initiate System Conversation (system)
SendMessage(-1,
  WM_DDE_INITIATE,
  hClientWnd,
  MAKELPARAM(aIBM327032,aSystem));
LOWORD/HIWORD to unpack
  WM_DDE_ACK(aIBM327032,aSystem)
Get System Configuration (system)
PostMessage(hServerWnd,
  WM_DDE_REQUEST,
  hClientWnd,
  MAKELPARAM(cfFormat,aSYSCON));
UnPackDDElParam(WM_DDE_DATA,hData,aSYSCON)
or
UnPackDDElParam(WM_DDE_ACK,wStatus,aSYSCON)
cfFormat = CF_TEXT
Get System Formats (system)
PostMessage(hServerWnd,
  WM_DDE_REQUEST,
  hClientWnd,
  MAKELPARAM(cfFormat,aFORMATS));
UnPackDDElParam(WM_DDE_DATA,hData,aFORMATS)
or
UnPackDDElParam(WM_DDE_ACK,wStatus,aFORMATS)
cfFormat = CF_TEXT
Get System Status (system)
PostMessage(hServerWnd,
  WM_DDE_REQUEST,
  hClientWnd,
  MAKELPARAM(cfFormat,aSTATUS));
UnPackDDElParam(WM_DDE_DATA,hData,aSTATUS)
or
UnPackDDElParam(WM_DDE_ACK,wStatus,aSTATUS)
cfFormat = CF_TEXT
Get System SysItems (system)
PostMessage(hServerWnd,
  WM_DDE_REQUEST,
  hClientWnd,
  MAKELPARAM(cfFormat,aSYSITEMS));
UnPackDDElParam(WM_DDE_DATA,hData,aSYSITEMS)
or
UnPackDDElParam(WM_DDE_ACK,wStatus,aSYSITEMS)
cfFormat = CF_TEXT
Get System Topics (system)
PostMessage(hServerWnd,
  WM_DDE_REQUEST,
  hClientWnd,
  MAKELPARAM(cfFormat,aTOPICS));
UnPackDDElParam(WM_DDE_DATA,hData,aTOPICS)
or
UnPackDDElParam(WM_DDE_ACK,wStatus,aTOPICS)
cfFormat = CF_TEXT
Terminate System Conversation (system)
SendMessage(hServerWnd,
  WM_DDE_TERMINATE,
  hClientWnd,
  0);
WM_DDE_TERMINATE
Initiate Session Conversation (session)
SendMessage(-1,
  WM_DDE_INITIATE,
  hClientWnd,
  MAKELPARAM(aIBM327032,aSessionN));
LOWORD/HIWORD to unpack
  WM_DDE_ACK(aIBM327032,aSessionN)
N = a session letter A through Z.
Find Field (session)
PostMessage(hServerWnd,
  WM_DDE_REQUEST,
  hClientWnd,
  MAKELPARAM(cfFormat,aFIELD));
UnPackDDElParam(WM_DDE_DATA,hData,aFIELD)
or
UnPackDDElParam(WM_DDE_ACK,wStatus,aFIELD)
cfFormat = CF_DSPTEXT
Get Keystrokes (session)
PostMessage(hServerWnd,
  WM_DDE_REQUEST,
  hClientWnd,
  MAKELPARAM(cfFormat,aKEYS));
UnPackDDElParam(WM_DDE_DATA,hData,aKEYS)
or
UnPackDDElParam(WM_DDE_ACK,wStatus,aKEYS)
cfFormat = CF_DSPTEXT
Get Mouse Input (session)
PostMessage(hServerWnd,
  WM_DDE_REQUEST,
  hClientWnd,
  MAKELPARAM(cfFormat,aMOUSE));
UnPackDDElParam(WM_DDE_DATA,hData,aMOUSE)
or
UnPackDDElParam(WM_DDE_ACK,wStatus,aMOUSE)
cfFormat = CF_TEXT | CF_DSPTEXT
Get Number of Close Requests (session)
PostMessage(hServerWnd,
  WM_DDE_REQUEST,
  hClientWnd,
  MAKELPARAM(cfFormat,aCLOSE));
UnPackDDElParam(WM_DDE_DATA,hData,aCLOSE)
or
UnPackDDElParam(WM_DDE_ACK,wStatus,aCLOSE)
cfFormat = CF_DSPTEXT
Get Operator Information Area (session)
PostMessage(hServerWnd,
  WM_DDE_REQUEST,
  hClientWnd,
  MAKELPARAM(cfFormat,aOIA));
UnPackDDElParam(WM_DDE_DATA,hData,aOIA)
or
UnPackDDElParam(WM_DDE_ACK,wStatus,aOIA)
cfFormat = CF_DSPTEXT
Get Partial Presentation Space (session)
PostMessage(hServerWnd,
  WM_DDE_REQUEST,
  hClientWnd,
  MAKELPARAM(cfFormat,aEPS));
UnPackDDElParam(WM_DDE_DATA,hData,aEPS)
or
UnPackDDElParam(WM_DDE_ACK,wStatus,aEPS)
cfFormat = CF_TEXT | CF_DSPTEXT
Get Presentation Space (session)
PostMessage(hServerWnd,
  WM_DDE_REQUEST,
  hClientWnd,
  MAKELPARAM(cfFormat,aPS));
UnPackDDElParam(WM_DDE_DATA,hData,aPS)
or
UnPackDDElParam(WM_DDE_ACK,wStatus,aPS)
cfFormat = CF_TEXT | CF_DSPTEXT
Get Session Status (session)
PostMessage(hServerWnd,
  WM_DDE_REQUEST,
  hClientWnd,
  MAKELPARAM(cfFormat,aSSTAT));
UnPackDDElParam(WM_DDE_DATA,hData,aSSTAT)
or
UnPackDDElParam(WM_DDE_ACK,wStatus,aSSTAT)
cfFormat = CF_TEXT
Get Trim Rectangle (session)
PostMessage(hServerWnd,
  WM_DDE_REQUEST,
  hClientWnd,
  MAKELPARAM(cfFormat,aTRIMRECT));
UnPackDDElParam(WM_DDE_DATA,hData,aTRIMRECT)
or
UnPackDDElParam(WM_DDE_ACK,wStatus,aTRIMRECT)
cfFormat = CF_TEXT
Put Data to Presentation Space (session)
PostMessage(hServerWnd,
  WM_DDE_POKE,
  hClientWnd,
  PackDDElParam(WM_DDE_POKE,
  hData,aEPS));
UnPackDDElParam(WM_DDE_ACK,wStatus,aEPS)
hData = Handle to a 
     global memory object
Search for String (session)
PostMessage(hServerWnd,
  WM_DDE_REQUEST,
  hClientWnd,
  MAKELPARAM(cfFormat,aSTRING));
UnPackDDElParam(WM_DDE_DATA,hData,aSTRING)
or
UnPackDDElParam(WM_DDE_ACK,wStatus,aSTRING)
cfFormat = CF_DSPTEXT
Send Keystrokes (session)
PostMessage(hServerWnd,
  WM_DDE_POKE,
  hClientWnd,
  PackDDElParam(WM_DDE_POKE,
  hData,aKEYS));
UnPackDDElParam(WM_DDE_ACK,wStatus,aKEYS)
hData = Handle to a 
     global memory object
Session Execute Macro (session)
PostMessage(hServerWnd,
  WM_DDE_EXECUTE,
  hClientWnd,
  (LPARAM)hCommands);
UnPackDDElParam(WM_DDE_ACK,wStatus, NULL)
hCommands = Handle to a 
        global memory object
Set Cursor Position (session)
PostMessage(hServerWnd,
  WM_DDE_POKE,
  hClientWnd,
  PackDDElParam(WM_DDE_POKE,
  hData,aSETCURSOR));
UnPackDDElParam(WM_DDE_ACK,wStatus,aSETCURSOR)
hData = Handle to a 
     global memory object
Set Mouse Intercept Condition (session)
PostMessage(hServerWnd,
  WM_DDE_POKE,
  hClientWnd,
  PackDDElParam(WM_DDE_POKE,
  hData,aMOUSE));
UnPackDDElParam(WM_DDE_ACK,wStatus,aMOUSE)
cfFormat = CF_TEXT | CF_DSPTEXT
hData = Handle to a 
    global memory object
Set Presentation Space Service Condition (session)
PostMessage(hServerWnd,
  WM_DDE_POKE,
  hClientWnd,
  PackDDElParam(WM_DDE_POKE,
  hData,aEPSCOND));
UnPackDDElParam(WM_DDE_ACK,wStatus,aEPSCOND)
hData = Handle to a 
     global memory object
Set Session Advise Condition (session)
PostMessage(hServerWnd,
  WM_DDE_POKE,
  hClientWnd,
  PackDDElParam(WM_DDE_POKE,
  hData,aPSCOND));
UnPackDDElParam(WM_DDE_ACK,wStatus,aPSCOND)
hData = Handle to a 
     global memory object
Start Close Intercept (session)
SendMessage(hServerWnd,
  WM_DDE_ADVISE,
  hClientWnd,
  PackDDElParam(WM_DDE_ADVISE,
  hOptions,aCLOSE));
UnPackDDElParam(WM_DDE_ACK,wStatus,aCLOSE)
or
UnPackDDElParam(WM_DDE_DATA,hData,aCLOSE)
hOptions = Handle to a 
       global memory object
Start Keystroke Intercept (session)
SendMessage(hServerWnd,
  WM_DDE_ADVISE,
  hClientWnd,
  PackDDElParam(WM_DDE_ADVISE,
  hOptions,aKEYS));
UnPackDDElParam(WM_DDE_ACK,wStatus,aKEYS)
or
UnPackDDElParam(WM_DDE_DATA,hData,aKEYS)
hOptions = Handle to a 
       global memory object
Start Mouse Input Intercept (session)
SendMessage(hServerWnd,
  WM_DDE_ADVISE,
  hClientWnd,
  PackDDElParam(WM_DDE_ADVISE,
  hOptions,aMOUSE));
UnPackDDElParam(WM_DDE_ACK,wStatus,aMOUSE)
or
UnPackDDElParam(WM_DDE_DATA,hData,aMOUSE)
hOptions = Handle to a 
       global memory object
Start Session Advise (session)
PostMessage(hServerWnd,
  WM_DDE_ADVISE,
  hClientWnd,
  PackDDElParam(WM_DDE_ADVISE,
  hOptions,aItem));
UnPackDDElParam(WM_DDE_ACK,wStatus,aItem)
or
UnPackDDElParam(WM_DDE_DATA,hData,aItem)
hOptions = Handle to a 
       global memory object
aItem = OIA | PS | TRIMRECT
Stop Close Intercept (session)
PostMessage(hServerWnd,
  WM_DDE_UNADVISE,
  hClientWnd,
  MAKELPARAM(NULL,aCLOSE));
UnPackDDElParam(WM_DDE_ACK,wStatus,aCLOSE)
Stop Keystroke Intercept (session)
PostMessage(hServerWnd,
  WM_DDE_UNADVISE,
  hClientWnd,
  MAKELPARAM(NULL,aKEYS));
UnPackDDElParam(WM_DDE_ACK,wStatus,aKEYS)
Stop Mouse Input Intercept (session)
PostMessage(hServerWnd,
  WM_DDE_UNADVISE,
  hClientWnd,
  MAKELPARAM(NULL,aMOUSE));
UnPackDDElParam(WM_DDE_ACK,wStatus,aMOUSE)
Stop Session Advise (session)
PostMessage(hServerWnd,
  WM_DDE_UNADVISE,
  hClientWnd,
  MAKELPARAM(NULL,aItem));
UnPackDDElParam(WM_DDE_ACK,wStatus,aItem)
aItem = SysItems | Topics | NULL
Terminate Session Conversation (session)
SendMessage(hServerWnd,
  WM_DDE_TERMINATE,
  hClientWnd,
  0);
WM_DDE_TERMINATE
Initiate Structured Field Conversation (structured field)
SendMessage(-1,
  WM_DDE_INITIATE,
  hClientWnd,
  MAKELPARAM(aIBM327032,aLUN_xxxx));
LOWORD/HIWORD to unpack
  WM_DDE_ACK(aIBM327032,aLUN_xxxx)
N = a session letter A through Z.
xxxx = a user defined string.
Terminate Structured Field Conversation (structured field)
SendMessage(hServerWnd,
  WM_DDE_TERMINATE,
  hClientWnd,
  0);
WM_DDE_TERMINATE
Set Structured Field Service Condition (structured field)
PostMessage(hServerWnd,
  WM_DDE_POKE,
  hClientWnd,
  PackDDElParam(WM_DDE_POKE,
  hData,aSFCOND));
UnPackDDElParam(WM_DDE_ACK,wStatus,aSFCOND)
hData = Handle to a 
     global memory object
Start Read SF (structured field)
PostMessage(hServerWnd,
  WM_DDE_ADVISE,
  hClientWnd,
  PackDDElParam(WM_DDE_ADVISE,
  hOptions,aSF));
UnPackDDElParam(WM_DDE_ACK,wStatus,aSF)
or
UnPackDDElParam(WM_DDE_DATA,hData,aSF)
hOptions = Handle to a 
       global memory object
Stop Read SF (structured field)
PostMessage(hServerWnd,
  WM_DDE_UNADVISE,
  hClientWnd,
  MAKELPARAM(NULL,aSF));
UnPackDDElParam(WM_DDE_ACK,wStatus,aSF)
Write SF (structured field)
PostMessage(hServerWnd,
  WM_DDE_POKE,
  hClientWnd,
  PackDDElParam(WM_DDE_POKE,
  hData,aSF));
UnPackDDElParam(WM_DDE_ACK,wStatus,aSF)
hData = Handle to a 
     global memory object
Initiate Menu Conversation (menu)
SendMessage(-1,
  WM_DDE_INITIATE,
  hClientWnd,
  MAKELPARAM(aIBM327032,a3270MenuSN));
LOWORD/HIWORD to unpack
  WM_DDE_ACK(aIBM327032,a3270MenuSN)
N = a session letter A through Z
Change Menu Item (menu)
PostMessage(hServerWnd,
  WM_DDE_POKE,
  hClientWnd,
  PackDDElParam(WM_DDE_POKE,
  hData,aCHANGEMENU));
UnPackDDElParam(WM_DDE_ACK,wStatus,aCHANGEMENU)
hData = Handle to a 
     global memory object
Create Menu Item (menu)
PostMessage(hServerWnd,
  WM_DDE_REQUEST,
  hClientWnd,
  MAKELPARAM(cfFormat,aCREATEMENU));
UnPackDDElParam(WM_DDE_DATA,hData,aCREATEMENU)
or
UnPackDDElParam(WM_DDE_ACK,wStatus,aCREATEMENU)
cfFormat = CF_DSPTEXT
Start Menu Advise (menu)
PostMessage(hServerWnd,
  WM_DDE_ADVISE,
  hClientWnd,
  PackDDElParam(WM_DDE_ADVISE,
  hOption,aSELECTMENU));
UnPackDDElParam(WM_DDE_ACK,wStatus,aSELECTMENU)
or
UnPackDDElParam(WM_DDE_DATA,hData,aSELECTMENU)
hData = Handle to a 
     global memory object
Stop Menu Advise (menu)
PostMessage(hServerWnd,
  WM_DDE_UNADVISE,
  hClientWnd,
  MAKELPARAM(NULL,aSELECTMENU));
UnPackDDElParam(WM_DDE_ACK,wStatus,aCLOSE)
Terminate Menu Conversation (menu)
SendMessage(hServerWnd,
  WM_DDE_TERMINATE,
  hClientWnd,
  0);
WM_DDE_TERMINATE