Send

Sends messages to a window, appointment notices to recipients, or SMS messages to a specified address.

To send

Use

A message to a window

Syntax 1 For sending messages to a window

A Pocket Outlook appointment to a recipient

Syntax 2 For POOMAppointment objects

An SMS message

Syntax 3 For SMSSession objects


Syntax 1 For sending messages to a window

Description

Sends a message to a window so that it is executed immediately.

Syntax

Send ( handle, message#, lowword, long )

Argument

Description

handle

A long whose value is the system handle of a window (that you have created in PocketBuilder or another application) to which you want to send a message.

message#

An UnsignedInteger whose value is the system message number of the message you want to send.

lowword

A long whose value is the integer value of the message. If this argument is not used by the message, enter 0.

long

The long value of the message or a string.

Returns

Long. Returns the value returned by SendMessage in Windows if it succeeds and -1 if an error occurs. If any argument’s value is null, Send returns null.

Usage

PocketBuilder’s Send function sends the message identified by message# and optionally, lowword and long, to the window identified by handle to the Windows function SendMessage. The message is sent directly to the object, bypassing the object’s message queue. Send waits until the message is processed and obtains the value returned by SendMessage.

NoteMessages in Windows Use the Handle function to get the Windows handle of a PocketBuilder object.

You specify Windows messages by number. They are documented in the file WINDOWS.H that is part of the Microsoft Windows Software Development Kit (SDK) and other Windows development tools.

NotePosting a message Messages sent with Send are executed immediately. To post a message to the end of an object’s message queue, use the Post function.

Examples

Example 1

This statement scrolls the window w_emp up one page:

Send(Handle(w_emp), 277, 2, 0)

Example 2

Both of the following statements click the CommandButton cb_OK:

Send(Handle(Parent), 273, 0, Handle(cb_OK))


cb_OK.TriggerEvent(Clicked!)

Example 3

You can send messages to maximize or minimize a DataWindow, and return it to normal. To use these messages, enable the TitleBar, Minimize, and Maximize properties of your DataWindow control. Also, you should give your DataWindow control an icon for its minimized state.

This statement minimizes the DataWindow:

Send(Handle(dw_whatever), 274, 61472, 0)

Example 4

This statement maximizes the DataWindow:

Send(Handle(dw_whatever), 274, 61488, 0)

Example 5

This statement returns the DataWindow to its normal, defined size:

Send(Handle(dw_whatever), 274, 61728, 0)

Example 6

You can send a Windows message to determine the last item clicked in a multiselect ListBox. The following script for the SelectionChanged event of a ListBox control gets the return value of the LB_GETCURSEL message which is the item number in the list (where the first item is 0, not 1). To get PocketBuilder’s index for the list item, the example adds 1 to the return value from Send. In this example, idx is an integer instance variable for the window:

// Send the Windows message for LB_GETCURSEL

// to the list box

idx = Send(Handle(This), 1033, 0, 0)

idx = idx + 1

See also


Syntax 2 For POOMAppointment objects

Description

Sends the appointment (meeting request) to all recipients.

Applies to

POOMAppointment objects

Syntax

Integer objectname.send ( )

Argument

Description

objectname

The name of the POOMAppointment or POOMTask object

Returns

Integer. Returns 1 for success and one of the following negative values if an error occurs:

See also


Syntax 3 For SMSSession objects

Description

Send an SMS message.

Applies to

SMSSession objects

Syntax

objectname.Send ( smsmsg, destaddr )

Argument

Description

objectname

The name of the SMSSession object

smsmsg

An SMSMessage structure returned by reference that contains information about the message

destaddr

An SMSAddress structure that contains the address to which the message should be sent

Returns

Integer. Returns 1 for success and a negative value if an error occurs.

Usage

The Send function sends an SMSMessage structure to an address specified in an SMSAddress structure.

Examples

Example 7

The following example sets the text of the g_smsMsg SMSMessage structure from a multiline edit box, sets the address from a single-line edit, and sends the message to an international phone number:

// Global variables: 
// SMSSession g_smsSess
// SMSMessage g_smsMsg
// SMSAddress g_smsmAddr

g_smsMsg.Text = mle_msg.text
g_smsAddr.AddressType = SMSAT_INTERNATIONAL!
g_smsAddr.Address = sle_addr.text
g_smsSess.Send(g_smsMsg, g_smsAddr)

See also