You are on page 1of 37

SVAPI

Programmer’s Reference Manual


This document will provide Programmer information for the SVAPI.

Programmer's Reference Manual


15 April 2011
© 2011, Sabre Inc. All rights reserved.
This documentation is the confidential and proprietary intellectual
property of Sabre Inc. Any unauthorized use, reproduction,
preparation of derivative works, performance, or display of this
document, or software represented by this document, without the
express written permission of Sabre Inc. is strictly prohibited.
Sabre, Sabre User and the Sabre logo design are trademarks
and/or service marks of an affiliate of Sabre Inc. All other
trademarks, service marks, and trade names are owned by their
respective companies.
Table of Contents

General Information .............................................................. 1

1.1 Introduction .......................................................................................................................... 1


1.2 Revision History ................................................................................................................... 1

Using DDE .......................................................................... 2

2.1 Communicating Through DDE ............................................................................................. 2


2.2 Establishing a Conversation ................................................................................................ 2
2.3 Receiving Data from Sabre for Windows ............................................................................. 3

Macros .......................................................................... 4

Example Code .................................................................... 28

4.1 C++ DDEML Client ............................................................................................................ 28


4.1.1 DDE Initialize.............................................................................................................. 28
4.1.2 DDE Uninitialize ......................................................................................................... 30
4.1.3 DDE Execute.............................................................................................................. 30
4.2 VB DDE Client ................................................................................................................... 32
4.2.1 DDE Linked TextBox .................................................................................................. 32
4.2.2 DDE Execute.............................................................................................................. 33
4.3 C Filter DLL ........................................................................................................................ 33
4.3.1 Compilation Requirements ......................................................................................... 33
4.3.2 DLL header file ........................................................................................................... 33
4.3.3 DLL implementation ................................................................................................... 34

SVAPI Programmer’s Guide. April, 2011 Confidential and Proprietary Sabre Inc. iii
General Information
1
1.1 Introduction

SVAPI is a legacy API that provides connectivity to Sabre through the use of Dynamic
Data Exchange (DDE) conversations with the Sabre for Windows application. The
DDE conversation grammar that SVAPI uses provides users of SVAPI with a means to
access many of the Sabre for Windows Macros. These Macros allow the control of
Sabre for Windows in a variety of ways as will be specified in the Macro Commands
section of this document.

1.2 Revision History

Document Creation: February 11th, 2011


Document Updated: April 15th, 2011

_____________________________________________________________________________________________
SVAPI Programmer’s Guide. April, 2011 Confidential and Proprietary Sabre Inc.
1
Using DDE

2
2.1 Communicating Through DDE

This section does not intend to educate the reader on Dynamic Data Exchange (DDE).
It is assumed that the reader is at least familiar with DDE by using it with other
applications such as Microsoft Excel.
Sabre for Windows can communicate with other applications via Window's Dynamic
Data Exchange (DDE) protocol. With DDE, Sabre for Windows acts like a server to
client applications wanting control over the emulator. Clients are able to take over the
current Sabre session and send data to and receive responses from Sabre.
An example of a program that uses DDE to talk to Sabre for Windows is the Weather
Forecast Dialog Box. This box is actually a standalone program (usually invoked by a
Soft Key) which lets the user build a request in a "point and click" manner and then
formats the request into the normal Sabre format. The client program then sends the
command to Sabre for Windows, and ultimately to Sabre, by using the established
DDE channel. Along with the transmission of data, the user is able to access the entire
Sabre for Windows Macro Command set. The collection of the DDE protocol along
with the macro command set is referred to as the Sabre for Windows Application
Programming Interface (SVAPI).

2.2 Establishing a Conversation

Starting a conversation with Sabre for Windows through DDE involves the
WM_DDE_INITIATE message. Where:
Application Name: SV
Topic Name: SVAPI

Note:
Sabre for Windows does not support the NULL or System topics at this time.

Accessing the Macro Commands


Using the macro commands of Sabre for Windows through DDE involves the
WM_DDE_EXECUTE message. DDE execute commands are contained in a string.
You may issue more than one macro command per each DDE execute message. The
following example creates a new window in the emulator and then sends an availability
request to Sabre.
[Begin][WinNew][WinCmd("1DFWTUL")][End]

_____________________________________________________________________________________________
SVAPI Programmer’s Guide. April, 2011 Confidential and Proprietary Sabre Inc.
2
The Begin and End commands are required in order to resolve contention problems
with multiple clients requesting services from Sabre for Windows at the same time.
External control of the emulator is indicated on the status line by the "Play" light. The
Begin command turns the "Play" light on, whereas the End command will turn the
"Play" light off. Sabre for Windows will reject a request to execute any macro
command if the "Play" light is not on. Sabre for Windows only supports one "Play"
session at a time, therefore if the "Play" was already lit when the Begin command was
executed then the entire execute command string would be rejected.

Notice how each macro command is enclosed by braces and the lack of any extraneous
spaces in the executable string.

2.3 Receiving Data from Sabre for Windows

Currently Sabre for Windows has two items which can be passed on to the DDE client
application. One of the items is called SVDATA and it retrieves the latest data from
Sabre which is displayed on the active window of the emulator. The second item is
called STATUSBAR and it retrieves all the status lights currently displayed on the
Sabre for Windows status line. There are two ways of retrieving this information by a
hot or cold link.
A hot link gets automatically updated every time a new response from Sabre is received
by Sabre for Windows. Hot links use the Advise method of the DDE protocol.
A cold link requires the client to request the information any time the client wants the
information. The cold link uses the Request method of the DDE protocol. A cold link
is appropriate when the client writes something to Sabre (using the WinCmd macro
command) and the wants to capture Sabre's response immediately afterwards. This
method helps synchronize the response with the command.
In both cases, the SVDATA or STATUSBAR item is passed to the client in the
CF_TEXT format. This means the data will consist of a series of strings delimited by
CR/LF characters with the buffer being NULL terminated. The first string consists of
only two characters - these are the C1 C2 characters returned by Sabre with the
response. The remaining strings contain the actual response.

_____________________________________________________________________________________________
SVAPI Programmer’s Guide. April, 2011 Confidential and Proprietary Sabre Inc.
3
Macros

3
Note: Reference the SNTE Wiki for the current list of completed Macros that are available.
http://wiki.sabre.com/confluence/display/Enabling/Sabre+Native+Terminal+Emulator+%28SN
TE%29

AddMessageFilter

Syntax:
AddMessageFilter("Filter.dll","SampleFilter")
This macro command installs a Filter Function.where:
Filter.dll - represents the DLL to be loaded. A path can be given; otherwise Windows
will search the current PATH environment.
SampleFilter - represents the name of the exported filter function. The format of the
filter function is:
VOID FilterFunction ( WORD wType, LPLONG lpLong )
where:
wType = 1 for a Sabre command, wType = 2 for a Sabre response lpLong represents a
far pointer to the LONG which contains the data handle

Begin

Syntax:
Begin ()
This macro command informs Sabre for Windows that macro command processing is
beginning. This command is only needed whenever external applications execute
Sabre for Windows macro commands via DDE. This command is not required when
executing macro commands from a file or from a Soft Key, in these instances the Begin
is automatic.

_____________________________________________________________________________________________
SVAPI Programmer’s Guide. April, 2011 Confidential and Proprietary Sabre Inc.
4
CharLeft

Syntax:
CharLeft(Count, ShiftKey)
This macro command moves the cursor left one character position. Count determines
the number of times the command is invoked. The following values are valid for the
ShiftKey parameter:
Value Description
0 shift key not down
1 shift key down

CharRight

Syntax:
CharRight(Count, ShiftKey)
This macro command moves the cursor right one character position. Count determines
the number of times the command is invoked. The following values are valid for the
ShiftKey parameter:
Value Description
0 shift key not down
1 shift key down

Clear

Syntax:
Clear()
This macro command clears the currently active MDI child win.

ClearAll

Syntax:
ClearAll()
This macro command clears all MDI child windows and the memo window.

CopyToMemo

Syntax:
CopyToMemo()
This macro command copies text, from SOM to current cursor position, to the memo
window.
_____________________________________________________________________________________________
SVAPI Programmer’s Guide. April, 2011 Confidential and Proprietary Sabre Inc.
5
_____________________________________________________________________________________________
SVAPI Programmer’s Guide. April, 2011 Confidential and Proprietary Sabre Inc.
6
Delete

Syntax:
Delete(Count, ShiftKey)
This macro command deletes the current character. Count determines the number of
times the command is invoked. The following values are valid for the ShiftKey
parameter:
Value Description
0 shift key not down
1 shift key down

DeleteLine

Syntax:
DeleteLine()
This macro command deletes any text on the current line of the active MDI child
window.

EchoCaretOff

Syntax:
EchoCaretOff()
This macro command was intended for use by external applications via DDE. The
effect of the command is to remove the echo caret which was displayed by a previous
call to EchoCaretOn().

EchoCaretOn

Syntax:
EchoCaretOn()
This macro command was intended for use by external applications via DDE. The
effect of the command is to echo the caret position without switching the focus to Sabre
for Windows.

_____________________________________________________________________________________________
SVAPI Programmer’s Guide. April, 2011 Confidential and Proprietary Sabre Inc.
7
End

Syntax:
End()
The end macro command is the compliment of the Begin macro command. It is also
only used by other Windows applications which communicate with Sabre for Windows
via DDE. The End macro command informs Sabre for Windows that macro command
processing has finished.

EndOfBuffer

Syntax:
EndOfBuffer(Count, ShiftKey)
This macro command moves the cursor to lower right corner of the entire scrollable
buffer. Count determines the number of times the command is invoked. The following
values are valid for the ShiftKey parameter:
Value Description
0 shift key not down
1 shift key down

EndOfLine

Syntax:
EndOfLine(Count, ShiftKey)
This macro command moves the cursor to end of current line. Count determines the
number of times the command is invoked. The following values are valid for the
ShiftKey parameter:
Value Description
0 shift key not down
1 shift key down

_____________________________________________________________________________________________
SVAPI Programmer’s Guide. April, 2011 Confidential and Proprietary Sabre Inc.
8
EndOfWindow

Syntax:
EndOfWindow(Count, ShiftKey)
This macro command moves the cursor to lower right corner of the current MDI child
window. Count determines the number of times the command is invoked. The
following values are valid for the ShiftKey parameter:
Value Description
0 shift key not down
1 shift key down

Enter

Syntax:
Enter()
This macro command sends text from SOM to EOM to Sabre.

Erase

Syntax:
Erase(EraseType)
This macro command will erase from the current cursor position to the end of line or
the end of the MDI child window buffer based on EraseType value. The following
values are valid for the EraseType parameter:
Value Description
EOL End of line
EOB End of MDI child window buffer

Full

Syntax:
Full()
This macro command switches to Full Screen Mode.

_____________________________________________________________________________________________
SVAPI Programmer’s Guide. April, 2011 Confidential and Proprietary Sabre Inc.
9
HideCaret

Syntax:
HideCaret()
This macro command will hide the Sabre for Windows cursor.

Home

Syntax:
Home()
This macro command sets cursor to first column in current row.

HostWait

Syntax:
HostWait()
This macro command will halt execution of a macro file until a response from Sabre is
received. This command is only needed if one Sabre command generates more than
one response from Sabre. A typical example is the Sabre SI command, which
generates two responses from Sabre.

InsertLine

Syntax:
InsertLine()
This macro command inserts a line above the current line.

Keys

Syntax:
Keys (Sabre command string)
This macro command displays the specified Sabre command string in the current MDI
child window. This command requires an "Enter" key before it will be sent to Sabre.
The command string may consist of any valid Sabre command.

_____________________________________________________________________________________________
SVAPI Programmer’s Guide. April, 2011 Confidential and Proprietary Sabre Inc.
10
KillMessageFilter

Syntax:
KillMessageFilter("SampleFilter")
This macro command removes a previously installed Filter Function defined by the
SampleFilter parameter. Sabre for Windows will automatically unload any remaining,
ill-behaved filter functions when it shuts down.

LineDown

Syntax:
LineDown(Count, ShiftKey)
This macro command moves cursor down one line. Count determines the number of
times the command is invoked. The following values are valid for the ShiftKey
pararmeter:
Value Description
0 shift key not down
1 shift key down

LineUp

Syntax:
LineUp(Count, ShiftKey)
This macro command moves the cursor up one line. Count determines the number of
times the command is invoked. The following values are valid for the ShiftKey
pararmeter:
Value Description
0 shift key not down
1 shift key down

_____________________________________________________________________________________________
SVAPI Programmer’s Guide. April, 2011 Confidential and Proprietary Sabre Inc.
11
LoadDefColors

Syntax:
LoadDefColors (Sabre Response Color, Blinking Color, User Text Color, Background
Color).
This macro command will load a set of default colors to be used by the Sabre for
Windows emulator for all MDI child windows when they are created. The parameters
used in this command are the same as the WinColor macro command.

LoadPFKeys

Syntax:
LoadPFKeys (Filename)
This macro command will load a programmable function key file which has previously
been defined via the PFKey - Define option. The full path name for a PF Key filename
may be specified, but if only the filename is specified the default path used by Sabre
for Windows will be used. The initial default path for Sabre for Windows is the
Windows directory.

LoadSoftKeys

Syntax:
LoadSoftKeys (Filename)
This macro command will load a soft key file which has previously been defined via
the SftKey – Define option. The full path name for a Soft Key filename may be
specified, but if only the filename is specified the default path used by Sabre for
Windows will be used. The initial default path for Sabre for Windows is the Windows
directory.

MdiArrangeIcons

Syntax:
MdiArrangeIcons()
This macro command allow all the iconized MDI child windows in a screen group to
be arranged at the bottom of the screen. There are no parameters for this command, in
order to specify the screen group to be used, the SetWindow and WinSelect macro
commands must be used.

_____________________________________________________________________________________________
SVAPI Programmer’s Guide. April, 2011 Confidential and Proprietary Sabre Inc.
12
MdiCascade

Syntax:
MdiCascade()
This macro command will cascade all the MDI child windows which are not iconized
in a selected Screen Group. The cascading of windows consists of sizing each window
so that only the title bar of each window is displayed for every window except the last
window, in a cascading fashion. This allows each window to be a normal size and
quick access to the other windows due to the fact that the title bar is accessible. The
MDI Cascade function is a standard Windows function. There are no parameters for
this command, in order to specify the screen group to be cascaded, the SetWindow and
WinSelect macro commands must be used.

MdiCloseAll

Syntax:
MdiCloseAll()
This macro command will close all the MDI child windows in a specified screen group.
There are no parameters for this command, in order to specify the screen group to be
used, the SetWindow and WinSelect macro commands must be used.

MdiTile

Syntax:
MdiTile()
This macro command will tile all the MDI child windows which are not iconized in a
selected Screen Group. The tiling of windows consists of sizing each window so that
there is no overlapping of the windows. The MDI Tile function is a standard Windows
function. In order to specify the screen group to be tiled, the SetWindow and WinSelect
macro commands must be used.

PageDown

Syntax:
PageDown(Count, ShiftKey)
This macro command moves down one page, equivalent to the PgDown key in the
windows keyboard. Count determines the number of times the command is invoked.
The following values are valid for the ShiftKey pararmeter:
Value Description
0 shift key not down
1 shift key down

_____________________________________________________________________________________________
SVAPI Programmer’s Guide. April, 2011 Confidential and Proprietary Sabre Inc.
13
PageUp

Syntax:
PageUp(Count, ShiftKey)
This macro command moves up one page, equivalent to the PgUp key in the windows
keyboard. Count determines the number of times the command is invoked. The
following values are valid for the ShiftKey pararmeter:
Value Description
0 shift key not down
1 shift key down

PasteAnswer

Syntax:
PasteAnswer (Question, Default Answer)
This macro command allows for an interactive dialog box to be displayed to the user in
order to solicit information from the user. The Question parameter is a string which in
conjunction with the Default Answer string forms a dialog box. The Question
parameter is a label which informs the user what to type in the provided edit box. The
Default Answer is an optional parameter which forms the default text of the edit box.
The information entered in the edit box will then be automatically pasted into the
currently active MDI child window. With this command, the user can be asked
questions in the middle of macro command processing and the user's answer becomes a
part of the final command which is sent to Sabre. The example shows how by using a
series of PasteAnswer and PasteString commands, a macro can be created which will
fill out hard to remember Sabre commands by asking the user a series of questions.

PasteString

Syntax:
PasteString (String)
This macro command allows for the pasting of text in an MDI child window in Sabre
for Windows. The paste operation is quicker than the WinPlayKeys macro command,
because it does not simulate keystrokes like the WinPlayKeys macro, but the end result
is equivalent. The string may consist of any valid Sabre characters. The example
shows how by using a series of PasteAnswer and PasteString commands, a macro can
be created which will fill out hard to remember Sabre commands by asking the user a
series of questions.

_____________________________________________________________________________________________
SVAPI Programmer’s Guide. April, 2011 Confidential and Proprietary Sabre Inc.
14
Pause

Syntax:
Pause()
This macro command Interrupts playback by displaying a message box before
proceeding. This Function cannot be recorded.

PFKeyDialog

Syntax:
PFKeyDialog()
This macro command launches the PFKey Dialog so that Programmable Function Keys
can be created or modified.

PrintEnter

Syntax:
PrintEnter()
This macro command tells Sabre to print text from SOM to EOM.

PrintReEnter

Syntax:
PrintReEnter()
This macro command tells Sabre to print last command.

ProtectedMode

Syntax:
ProtectedMode()
This macro command forces the emulator into Protected Mode.

QuickScrollDown

Syntax:
QuickScrollDown()
This macro command scrolls the display down to the next command in the accumulated
response buffer.

_____________________________________________________________________________________________
SVAPI Programmer’s Guide. April, 2011 Confidential and Proprietary Sabre Inc.
15
QuickScrollUp

Syntax:
QuickScrollUp()
This macro command scrolls the display up to the next command in the accumulated
response buffer.

Reenter

Syntax:
Reenter()
This macro command sends previous command back to Sabre.

ReplayNextEntry

Syntax:
ReplayNextEntry()
This macro command displays the next command in the command history at the SOM.

ReplayPriorEntry

Syntax:
ReplayPriorEntry()
This macro command displays the previous command in the command history at the
SOM.

ReplaySABRE

Syntax:
ReplaySABRE()
This macro command replays a series of Sabre commands from the SABREReplay
buffer. The user must first use the ALT-Up keys to scroll through the Sabre entries to
be played, and then execute the macro command.

_____________________________________________________________________________________________
SVAPI Programmer’s Guide. April, 2011 Confidential and Proprietary Sabre Inc.
16
Reroute

Syntax:
Reroute()
This macro command will issue the text from SOM to current cursor position to Sabre,
then reroute Sabre's response to the next MDI child window. If the current screen
group has only one MDI child window the response will not be rerouted.

Reset

Syntax:
Reset()
This macro command resets the SOM. Performs same action as the escape key.
RoomDisplayType

Syntax:
RoomDisplayType(Display Type)
This macro command sets display type to full or split for current window group. The
following values are valid for the Display Type parameter:
Value Description
LONG sets response display to full
SHORT sets response display to split

ScreenWrite

Syntax:
ScreenWrite(Row,Col,Text)
This macro command writes the Text data to the active MDI child window at position
Row,Col.

SendCommand

Syntax:
SendCommand()
This macro sends the text from SOM to EOM to Sabre.

_____________________________________________________________________________________________
SVAPI Programmer’s Guide. April, 2011 Confidential and Proprietary Sabre Inc.
17
SetKeyLock

Syntax:
SetKeyLock(ON/OFF)
This macro command will turn the status bar KbdLock light on if the ON/OFF
parameter is set to 1 and off if set to 0.

SetMenu

Syntax:
SetMenu(Menu Type)
This macro command will change the menu type used by the Sabre for Windows
application. There are two types of menus available in Sabre for Windows which are
defined below:
Menu Type Description
LONG Full Sabre for Windows menus
SHORT Condensed Sabre for Windows menus
The difference between the two types of Sabre for Windows menus is the absence of
the Soft Key and Screen Group menu options on the Sabre for Windows menu bar, if
the short menu option is selected.
These menu options are considered advance features of the Sabre for Windows
emulator and can therefore be excluded from the menu bar if desired.

SetSOM

Syntax:
SetSOM()
This macro command sets SOM indicator at the current cursor position.

SetTabs

Syntax:
SetTabs(Setting1,Setting2,...)
This macro command sets a tab for each Setting parameter provided. The tabs will
effect editing in all MDI child windows.

_____________________________________________________________________________________________
SVAPI Programmer’s Guide. April, 2011 Confidential and Proprietary Sabre Inc.
18
SetWindow

Syntax:
SetWindow(Window Type)
This command will set the window type which is to have operations performed on it.
There are three window types which are defined below:
Window Type Description
Frame The Sabre for Windows Frame Window
Room A Sabre for Windows Screen Group Window
Window A Sabre for Windows MDI child window
Once the type of window to have operations performed on has been selected via this
command, the WinSelect macro command should be used in order to specify a
particular Screen Group or MDI child window.

ShowCaret

Syntax:
ShowCaret()
This macro command will show the Sabre for Windows cursor if hidden by a previous
call to HideCaret().

Split

Syntax:
Split()
This macro command switches to Split Screen Mode.

StartOfBuffer

Syntax:
StartOfBuffer(Count, ShiftKey)
This macro command moves the cursor to the upper left corner of the entire scrollable
buffer. Count determines the number of times the command is invoked. The following
values are valid for the ShiftKey pararmeter:
Value Description
0 shift key not down
1 shift key down

_____________________________________________________________________________________________
SVAPI Programmer’s Guide. April, 2011 Confidential and Proprietary Sabre Inc.
19
StartOfLine

Syntax:
StartOfLine(Count, ShiftKey)
This macro command moves the cursor to the start of the current line. Count
determines the number of times the command is invoked. The following values are
valid for the ShiftKey pararmeter:
Value Description
0 shift key not down
1 shift key down

StartOfWindow

Syntax:
StartOfWindow(Count, ShiftKey)
This macro command moves the cursor to the upper left corner of the current MDI
child window. Count determines the number of times the command is invoked. The
following values are valid for the ShiftKey pararmeter:
Value Description
0 shift key not down
1 shift key down

StatusFieldAdd

Syntax:
StatusFieldAdd(ID, Size)
This macro command will add a field to the Sabre for Windows status bar. The ID
parameter must be any unique number between 0 and 3000 (other values will conflict
with predefined status bar fields). This ID will be used when referring to this field in
other macro commands that may resize or remove the field. The Size parameter
represents the initial size of the new field. It is given in units of characters and is based
on the average character width of the proportional font used in the control. For
example a size of 12 should reserve enough space for ten average width characters with
a little space left for aesthetic purposes. The example below will add a field with an ID
of 99 and a Size of 12 average width characters.
Example:
StatusFieldAdd(99,12)

_____________________________________________________________________________________________
SVAPI Programmer’s Guide. April, 2011 Confidential and Proprietary Sabre Inc.
20
StatusFieldAdd

Syntax:
StatusFieldAdd(ID, Size)
This macro command will add a field to the Sabre for Windows status bar. The ID
parameter must be any unique number between 0 and 3000 (other values will conflict
with predefined status bar fields). This ID will be used when referring to this field in
other macro commands that may resize or remove the field. The Size parameter
represents the initial size of the new field. It is given in units of characters and is based
on the average character width of the proportional font used in the control. For
example a size of 12 should reserve enough space for ten average width characters with
a little space left for aesthetic purposes. The example below will add a field with an ID
of 99 and a Size of 12 average width characters.
Example:
StatusFieldAdd(99,12)

StatusFieldRemove

Syntax:
StatusFieldRemove(ID)
This macro command will remove the Sabre for Windows status bar field identified by
ID. This function only works with id's less than 3000.

StatusFieldResize

Syntax:
StatusFieldResize(ID,Size)
This macro command will resize the Sabre for Windows status bar field identified by
ID to Size units. This ID corresponds to the ID defined in the StatusFieldAdd macro
when the field was created. This function only works with ID's less than 3000.

_____________________________________________________________________________________________
SVAPI Programmer’s Guide. April, 2011 Confidential and Proprietary Sabre Inc.
21
StatusFieldSetText

Syntax:
StatusFieldSetText(ID,Text)
This macro command sets the text of an existing Sabre for Windows status bar field
identified by ID. The field's text will be set to the value Text. This function will work
with id's less than 3000 as well as with the predefined ID's. The predefined ID's are as
follows:
Value Description
Lights field 0xF0A
Time field 0xF0B
Product Id field 0xF0C
LNIATA field 0xF0D
The following Example places the text "Dev Error 12" in the user defined field 99:
StatusFieldSetText(99,"Dev Error 12")
The following Example places the product name "SabreHelp" in the predefined Product
ID field:StatusFieldSetText(0xF0C,"SabreHelp")
The following Example restores the product name in the Product ID field to Sabre for
Windows. Note: this restore functionality is only implemented for the Product Id field.
StatusFieldSetText(0xF0C,"")

ToggleInsert

Syntax:
ToggleInsert(Insert Mode)
This macro command will set the insert mode to insert or overstrike. The following
values are valid for the Insert Mode parameter:
Value Description
ON sets the mode to insert
OFF sets the mode to overstrike

_____________________________________________________________________________________________
SVAPI Programmer’s Guide. April, 2011 Confidential and Proprietary Sabre Inc.
22
WinClose

Syntax:
WinClose ()
This macro command allows any type of Sabre window to be closed; therefore, the
Sabre for Windows application, a Sabre for Windows Screen Group, or an MDI child
window can be closed via this command. There are no parameters for this command.
In order to select the window to be closed, the SetWindow and WinSelect macro
commands should be used.

WinCmd

Syntax:
WinCmd (Sabre command string)
This macro command will send the specified Sabre command string to Sabre via the
currently selected MDI child window. The command string will be echoed in the MDI
child window along with the Sabre response to the command. The command string
may consist of any valid Sabre command. If a Sabre command string is not provided,
then the WinCmd macro will simply simulate the Enter key being depressed.

_____________________________________________________________________________________________
SVAPI Programmer’s Guide. April, 2011 Confidential and Proprietary Sabre Inc.
23
WinColor

Syntax:
WinColor (Sabre Response Color, Blinking Color, User Text Color, Background
Color)
This function allows the user to change the colors of an MDI window. The Sabre
Response Color parameter changes the color of all text which Sabre sends to Sabre for
Windows. The Blinking Color parameter changes the color of all Sabre blinking text
(blinking text is not feasible in the Windows environment; therefore a special color is
used to denote text which should be blinking). The User Text Color changes the color
of all text which is typed in by the user. The Background Color parameter changes the
background color of the MDI window. The following values are valid for the color
parameters:
Value Color
0 Black
7F7F7F Gray
FF Red
7F Magenta
FFFF Yellow
7F7F Brown
FF00 Green
7F00 Dark Green
7F7F00 Blue-Green
FFFF00 Cyan
FF0000 Blue
7F0000 Purple
FF00FF Pink
7F007F Violet
FFFFFF White
The parameter values reflect the amount of red, green, and blue which are present in
each color. The values are in hexadecimal notation and from the chart above it can be
seen that 0xFF = Red, 0xFF00 = Green, and 0xFF0000 = Blue; by combining these
three colors, all other colors are possible. The number 0xFF, which is 255 decimal,
describes the intensity of the color, therefore 7F, which is 127 decimal, is half the
intensity of 0xFF. The hexadecimal notation is a Windows standard for describing
color attributes, and this notation will allow for future expansion of color attributes if
needed. At the present time, only the colors listed in the chart above are valid.

_____________________________________________________________________________________________
SVAPI Programmer’s Guide. April, 2011 Confidential and Proprietary Sabre Inc.
24
WinDisplay

Syntax:
WinDisplay(Window type, Position, Height/Width)
This macro command informs the Sabre for Windows emulator that either the PF Key
or Soft Key window is to be displayed on the screen. The PF Key and Soft Key
windows contain the labels for currently defined keys. The first parameter describes
the window type, currently defined window types are:
Window type Value
PF Key Window PFKey
Soft Key Window SftKey
The second parameter describes the position for the window, valid positions are as
follows:
Position Value
Bottom of screen Bottom
Top of screen Top
Left side of screen Left
Right side of screen Right
The third parameter determines the size of the window. For windows displayed on the
top or bottom, this parameter is the height of the window; for windows displayed on
the left or right side of the screen, this parameter is the width of the window. The value
is given in pixel units, a typical value would be 50 for PF Key or Soft Key windows.

WinMaximize

Syntax:
WinMaximize()
This function will maximize the currently selected window. This function can only be
used on the frame and MDI child windows. This command does not apply to screen
groups. There are no parameters for this command.

WinMinimize

Syntax:
WinMinimize()
This function will minimize the currently selected window. This function can only be
used on the frame and MDI child windows. This command does not apply to screen
groups. There are no parameters for this command.

_____________________________________________________________________________________________
SVAPI Programmer’s Guide. April, 2011 Confidential and Proprietary Sabre Inc.
25
WinMove

Syntax:
WinMove (Upper-Left X-Coordinate, Upper-Left Y-Coordinate, Window Width,
Window Height)
This function allows the frame or MDI child windows to be moved and sized. The first
parameter specifies the new upper-left X-coordinate for the window position. The
second parameter specifies the new upperleft Y-coordinate for the window position.
The third and fourth parameters specify the new width and height of the window. All
coordinates are in screen pixel units.

WinNew

Syntax:
WinNew()
This command allows for the creation of a new screen group or MDI child window.
Before using this command, the type of window to be created must first be set via the
SetWindow macro command. This command has no parameters.

WinNext

Syntax:
WinNext()
This macro command will select the next MDI child or screen group window which is
available. This command is used to sequentially select the next window of a given type
(either MDI or screen group). This command can be used in place of the WinSelect
macro command if the user desires to sequentially access various windows and perform
operations. The function performed by this command is identical to the WinSelect
macro command.

WinPlayKeys

Syntax:
WinPlayKeys (String)
This command allows for a text string to be entered in an MDI child window. The
string can consist of any valid Sabre characters. The primary difference between this
command and the macro WinCmd is that the string is not automatically sent to Sabre.
Therefore, this command allows text to be sent to the MDI child and additional text to
be entered by the user before being sent to Sabre

_____________________________________________________________________________________________
SVAPI Programmer’s Guide. April, 2011 Confidential and Proprietary Sabre Inc.
26
WinRename

Syntax:
WinRename(Name)
This command allows for the renaming of a selected screen group or MDI child
window in the Sabre for Windows application. Once the window has been selected
using the WinSelect and SetWindow macro commands; this command may be used to
rename the window. All window names should only consist of one word.

WinRestore

Syntax:
WinRestore()
This macro command will restore either the frame window or an MDI child window
from a minimized or maximized state to the window's original size. The window to be
restored must first be selected using the SetWindow and WinSelect macro commands.

WinSabrePlay

Syntax:
WinSabrePlay(FileName)
This macro command will play a series of Sabre entries stored in the file FileName.
Each Sabre entry should reside on a separate line in the file.

WinSelect

Syntax:
WinSelect (Window Number)
This function can be used with either MDI child windows or screen groups in the Sabre
for Windows Emulator. The number of the window to be selected is the only
parameter for this command. Before any type of window related macro command can
be performed on a window, the desired window must be first be selected with this
function. All windows begin with the number one, MDI child windows are limited to
nine and screen groups are limited to nine as well at the present time. In order to select
the type of Window, MDI child or screen group, the SetWindow macro command must
be used first.

_____________________________________________________________________________________________
SVAPI Programmer’s Guide. April, 2011 Confidential and Proprietary Sabre Inc.
27
Example Code

4
4.1 C++ DDEML Client

This section provides example code for various scenarios.

4.1.1 DDE Initialize

void CDDESVAPICppExampleDlg::DDE_Initialize()

//MessageBox("Beginning DDE SVAPI Message Execute Example");

//Initialize DDE
//MessageBox("Initialize DDE");

m_idInst = 0;

DdeInitialize(&m_idInst, // receives instance identifier

DdeCallback, // pointer to callback function


APPCMD_CLIENTONLY, // filter notifications
0);

//Create Application Name and Topic


//MessageBox("Create Application Name \"SV\" and Topic \"SVAPI\"");

m_hszServName;
m_hszSysTopic;

m_hszServName = DdeCreateStringHandle(
m_idInst, // instance identifier
"SV", // string to register

CP_WINANSI); // Windows ANSI code page

m_hszSysTopic = DdeCreateStringHandle(
m_idInst, // instance identifier

"SVAPI", // System topic


CP_WINANSI); // Windows ANSI code page

m_hszItemName = DdeCreateStringHandle(

m_idInst, // instance identifier

_____________________________________________________________________________________________
SVAPI Programmer’s Guide. April, 2011 Confidential and Proprietary Sabre Inc.
28
"SVDATA", // string to register
CP_WINANSI); // Windows ANSI code page

//Connect to DDE Server using Apllication Name and Topic


//MessageBox("Connect to DDE Server using Apllication Name and Topic");

m_hConv = DdeConnect(

m_idInst, // instance identifier

m_hszServName, // service name string handle

m_hszSysTopic, // System topic string handle

(PCONVCONTEXT) NULL); // use default context

if (m_hConv == NULL)

MessageBox("MyServer is unavailable.");

//Free Application Name and Topic

MessageBox("Free Application Name \"SV\" and Topic \"SVAPI\"");

DdeFreeStringHandle(m_idInst, m_hszServName);
DdeFreeStringHandle(m_idInst, m_hszSysTopic);

//Uninitialize DDE
MessageBox("Uninitialize DDE");

DdeUninitialize(m_idInst);

MessageBox("Ending DDE SVAPI test application due to error");


return;
}
return;

_____________________________________________________________________________________________
SVAPI Programmer’s Guide. April, 2011 Confidential and Proprietary Sabre Inc.
29
4.1.2 DDE Uninitialize

void CDDESVAPICppExampleDlg::DDE_UnInitialize()

//Disconnect from DDE Server


//MessageBox("Disconnect from DDE Server");

DdeDisconnect(m_hConv);

//Free Application Name and Topic

//MessageBox("Free Application Name \"SV\" and Topic \"SVAPI\"");

DdeFreeStringHandle(m_idInst, m_hszServName);
DdeFreeStringHandle(m_idInst, m_hszSysTopic);

//Uninitialize DDE
//MessageBox("Uninitialize DDE");

DdeUninitialize(m_idInst);

//MessageBox("Ending DDE SVAPI Example");

return;
}

4.1.3 DDE Execute

void CDDESVAPICppExampleDlg::DDE_Execute(CString* pDDE_String)


{

//Create DDE Transaction


//MessageBox("Create DDE Transaction");

HDDEDATA hData;
//unsigned char ucData[] = {"[Begin][WinNew][WinCmd(\"1DFWLAX\")][End]"};

//LPBYTE pData = ucData;

LPBYTE pData = (unsigned


char*)((*pDDE_String).GetBuffer((*pDDE_String).GetLength()));

DWORD dwResult;
hData = DdeClientTransaction(

pData, // pointer to data to pass to server

(DWORD)strlen((const char*)pData) + 1, // length of data


m_hConv, // handle to conversation
(HSZ)0L, // handle to item name string

(UINT)0, // clipboard data format

_____________________________________________________________________________________________
SVAPI Programmer’s Guide. April, 2011 Confidential and Proprietary Sabre Inc.
30
XTYP_EXECUTE, // transaction type
(DWORD)6000, // time-out duration

(LPDWORD) &dwResult // pointer to transaction result

);
if(hData == 0)

{
//DdeClientTransaction resulted in an error

MessageBox("DdeClientTransaction resulted in an error");

UINT uiLastError = DdeGetLastError(m_idInst);

switch(uiLastError)
{

case DMLERR_ADVACKTIMEOUT:

MessageBox("Error DMLERR_ADVACKTIMEOUT");

break;
case DMLERR_BUSY:

MessageBox("Error DMLERR_BUSY");

break;
case DMLERR_DATAACKTIMEOUT:
MessageBox("Error DMLERR_DATAACKTIMEOUT");
break;

case DMLERR_DLL_NOT_INITIALIZED:
MessageBox("Error DMLERR_DLL_NOT_INITIALIZED");
break;
case DMLERR_EXECACKTIMEOUT:
MessageBox("Error DMLERR_EXECACKTIMEOUT");

break;
case DMLERR_INVALIDPARAMETER:
MessageBox("Error DMLERR_INVALIDPARAMETER");
break;
case DMLERR_MEMORY_ERROR:
MessageBox("Error DMLERR_MEMORY_ERROR");

break;

case DMLERR_NO_CONV_ESTABLISHED:
MessageBox("Error DMLERR_NO_CONV_ESTABLISHED");

break;

case DMLERR_NO_ERROR:
MessageBox("Error DMLERR_NO_ERROR");
break;

case DMLERR_NOTPROCESSED:
MessageBox("Error DMLERR_NOTPROCESSED");
break;

case DMLERR_POKEACKTIMEOUT:

_____________________________________________________________________________________________
SVAPI Programmer’s Guide. April, 2011 Confidential and Proprietary Sabre Inc.
31
MessageBox("Error DMLERR_POKEACKTIMEOUT");
break;

case DMLERR_POSTMSG_FAILED:

MessageBox("Error DMLERR_POSTMSG_FAILED");
break;

case DMLERR_REENTRANCY:
MessageBox("Error DMLERR_REENTRANCY");

break;

case DMLERR_SERVER_DIED:

MessageBox("Error DMLERR_SERVER_DIED");

break;
case DMLERR_UNADVACKTIMEOUT:

MessageBox("Error DMLERR_UNADVACKTIMEOUT");

break;

default:
MessageBox("Error UNKNOWN");

break;

}
}

//Free DDE Transaction

//MessageBox("Free DDE Transaction");

DdeFreeDataHandle(hData);

return;

4.2 VB DDE Client

This section provides example code for various scenarios.

4.2.1 DDE Linked TextBox

Begin VB.TextBox Text1

Height = 1335

Left = 120
LinkItem = "SVDATA"
LinkTopic = "SV|SVAPI"
MultiLine = -1 'True

ScrollBars = 3 'Both
TabIndex = 0

Text = "Form1.frx":0000

_____________________________________________________________________________________________
SVAPI Programmer’s Guide. April, 2011 Confidential and Proprietary Sabre Inc.
32
ToolTipText = "This TextBox contains the output of the Sabre for
Windows Emulator Data"
Top = 120

Width = 6615

End

4.2.2 DDE Execute

Private Sub Begin_Click()


On Error Resume Next

Text1.LinkExecute ("[Begin]")

End Sub

4.3 C Filter DLL

This section provides example code for various scenarios.

4.3.1 Compilation Requirements

Sabre for Windows was written using a 16bit C++ compiler from Microsoft.
Consequently Sabre for Windows is a 16bit windows application and is only able to
load 16bit DLLs. Sabre for windows can not load 32bit DLLs unless the 32bit DLL is
loaded by an intermediate “Thunk” layer 16bit DLL. An example of a “Thunk” layer
that Sabre for Windows currently uses is Sabserv.exe. Sabre for Windows loads a
16bit DLL that provides a Remote Procedure Call (RPC) interface to Sabserv.exe.
Since Sabserv.exe is 32bit it can then load the various 32bit DLLs that provide 16bit
Sabre for Windows with a means to use the current 32bit Sabre communications stack.

4.3.2 DLL header file

#ifndef __SVFILTER_H
#define __SVFILTER_H

#include <windows.h>

#ifdef __cplusplus

extern "C"
{

#endif

#ifndef IMPEXP

#define IMPEXP __declspec(dllimport)


#endif

IMPEXP void FilterFunction( WORD wType, LPLONG lpLong );

_____________________________________________________________________________________________
SVAPI Programmer’s Guide. April, 2011 Confidential and Proprietary Sabre Inc.
33
//wType = 1 for a Sabre Entry

//wType = 2 for a Sabre Response

//lpLong = a far pointer to the data handle filtered from Sabre for windows

#ifdef __cplusplus
}

#endif

#endif

4.3.3 DLL implementation

#define IMPEXP __declspec(dllexport)

#include "SVFilter.h"

IMPEXP void FilterFunction( WORD wType, LPLONG lpLong )


{
switch(wType)

{
case 1:

MessageBox(NULL, "FilterFunction received type 1 data", "Info",


MB_OK|MB_ICONINFORMATION);

case 2:
MessageBox(NULL, "FilterFunction received type 2 data", "Info",
MB_OK|MB_ICONINFORMATION);
default:
MessageBox(NULL, "FilterFunction received invalid type", "Error",
MB_OK|MB_ICONERROR);

}
}

_____________________________________________________________________________________________
SVAPI Programmer’s Guide. April, 2011 Confidential and Proprietary Sabre Inc.
34

You might also like