DDE Programming Quick Reference

Return to Introduction

Activate Screen Position Calculator

Initiate Channel

The following will initiate a conversation between the Client ( a microsoft office application) and the server {the Client Access 5250 session}

Dim Application as String

Dim SessTopic as String

Dim ChanA as Variant

Rem Application for Client Access 5250 session is always IBM525032

Application = "IBM525032"

Rem Session topic is the word Session with the session letter

Rem appended to it. Session letters A to Z

SessTopic = "SessionA"

Rem Initiate DDE session and retrieve channel number

ChanA = DDEInitiate(Application, SessTopic)

* always include a terminate channel command at the end of your program to free up system resources.

Retrieve information from Session

Dim SessionStat as String

Dim OperInfoArea as String

SessionStat = DDERequest (ChanA, "SSTAT") ‘ Retrieve string with Session Status information

OperInfoArea = DDERequest (ChanA, "OIA") ‘ Retrieve information from the Operator Information Area

Retrieve information about Partial Presentation Space

Presentation Space Info = DDERequest(DDE Channel, "EPS (Start point of presentation space,Character length of space,EOF Switch)")

{EOF Switch} can be 1 for yes or 0 for no

Dim PPspace as String

PPSpace = DDERequest (ChanA, "EPS" & "(" & "0716,20,0" & ")" )

 

Search for Text on Screen

Location of Text on screen = DDERequest (DDE Channel number, "STRING" & "(" & "Start point of search,Search Direction" & Chr(34) & SearchStr & Chr(34) & ")")

Returns location of the first character of text on screen as offset from top right corner of screen as a numeric string. May be any number from 0 to 1919 for a 24 x 80 screen

If the string is not found then the word {NONE} is returned.

The {start point of search} is the offset number to start searching from. Ext 0970 will start search from row 13 column 11

The {Search Direction} can be the number 1 to search forward or zero 0 to search backward.

Dim StringLoc as String

Dim SearchStr as String

StringLoc = DDERequest (ChanA, "STRING" & "(" & "0524,1" & Chr(34) & SearchStr & Chr(34) & ")")

StringLoc = Left(StringLoc,4) ‘ Occasionally there will be extra characters on the end of the text. This statement will discard all but the first 4.

Write Text to Screen

DDEPoke Channel Number,EPS(Offset start position, EOF switch),Test to write to session

Dim TextLine as String ‘ to write to session

DDEPoke ChanA, "EPS" & "(1468,1)", TextLine ’ Start writing from row 19 column 29

Commands and Program Function Keys

DDEExecute Channel ID,"[SENDKEY(Function Key number or command)]"

Function Keys 1-24 pf1, pf2, ……., pf24

‘use SENDKEY command

DDEExecute ChanA, "[SENDKEY(pf8)]" ‘ Program Function Key

DDEExecute ChanA, "[SENDKEY(enter)]" ‘ Enter or Return

DDEExecute ChanA, "[SENDKEY(tab field)]" ‘ Tab Key

DDEExecute ChanA, "[SENDKEY(page up)]" ‘ Page up Key

DDEExecute ChanA, "[SENDKEY(page down)]" ‘ Page down Key

DDEExecute ChanA, "[SENDKEY(reset)]" ‘ Same as pressing Ctrl Key

DDEExecute ChanA, "[SENDKEY(wait inp inh)]" ‘Wait until input is no longer inhibited, Command should follow any change in screen. Use this liberally and you will save yourself aggravation.

DDEExecute ChanA, "[SENDKEY(" & Chr(34) & "1" & Chr(34) & ")]" ‘Enter String (1) using SENDKEY command

DDEExecute ChanA, "[SENDKEY(" & Chr(34) & TextString & Chr(34) & ")]" ‘Enter String using variable and a SENDKEY command

 

DDEExecute ChanA, "[WAIT(" & Chr(34) & "1 sec" & Chr(34) & ")]" ‘ Wait for 1 second


DDEExecute ChanA, "[WAIT(" & Chr(34) & "250 msec" & Chr(34) & ")]" ‘ Wait for 250 milliseconds or 1/4 second

Set Cursor position

DDEPoke ChanA, "SETCURSOR" ,"1468" ’ Set cursor to row 19 column 29

Often used with SendKeys command to set start point of input. See calculator at the top of the page.

Terminate Channel

DDETerminate (Channel Number)

This command will terminate the specified DDE channel

DDETerminate (ChanA)

The DDETerminateAll command will terminate all conversations on the PC. Use with caution.

DDETerminateAll

Note that words within Commands in Italics are variable names. Underlined values will change according to the requirements of the application.

'); newWindow.document.write('\n'); newWindow.document.write('
'); newWindow.document.write('\n'); newWindow.document.write('

'); newWindow.document.write('\n'); newWindow.document.write('

'); newWindow.document.write('\n'); newWindow.document.write('24 Row x 80 Column
'); newWindow.document.write('\n'); newWindow.document.write('Screen Position Calculator

'); newWindow.document.write('\n'); newWindow.document.write('

'); newWindow.document.write('
'); newWindow.document.write('\n'); newWindow.document.write(' '); newWindow.document.write('\n'); newWindow.document.write('_ X _

'); newWindow.document.write('\n'); newWindow.document.write('
'); newWindow.document.write('\n'); newWindow.document.write('

'); newWindow.document.write('\n'); newWindow.document.write('

'); newWindow.document.write('\n'); newWindow.document.write('
'); newWindow.document.write('\n'); newWindow.document.write('
'); newWindow.document.write('\n'); newWindow.document.write('
Hosted by www.Geocities.ws

1