GetDeskRect

Description

On a Pocket PC device or emulator, gets the rectangular coordinates, in pixels, of the current window—which does not include the area occupied by the Soft Input Panel (SIP) when the latter is visible. On the desktop, GetDeskRect gets the coordinates of the desktop monitor.

Syntax

int GetDeskRect (long left, long top, long right, long bottom)

Argument

Description

left

Leftmost value (typically 0) of the rectangular area occupied by the:

  • current window on a Pocket PC device or emulator

  • monitor for the desktop

top

Topmost value of the rectangular area occupied by the:

  • current window on a Pocket PC device or emulator (typically 26)

  • monitor for the desktop (typically 0)

right

Rightmost value of the rectangular area occupied by the:

  • current window on a Pocket PC device or emulator (typically 240)

  • monitor for the desktop (for example, 1024 on a monitor with a desktop area of 1024 by 768 pixels)

bottom

Bottommost value of the rectangular area occupied by:

  • current window on a Pocket PC device or emulator (typically 214 when the SIP is visible and 320 when the SIP is not visible)

  • monitor for the desktop (for example, 768 on a monitor with a desktop area of 1024 by 768 pixels)

Returns

Integer. Returns 1 for success and -1 for failure.

Usage

Typically it is useful to know the bottommost coordinate of the current window when the SIP is visible. That way you can adjust the positions and sizes of controls on the window to account for the smaller display size of the window when the SIP is being used.

Examples

Example 1

The following example displays the coordinates for the current window in a multiline edit text box:

String strDisplay=""
int rc
long left = 0, top = 0, right = 0, bottom = 0

rc = GetDeskRect(left, top, right, bottom)
strDisplay +=("Desk RECT:~r~n~t Left = " +string(left)&
 +"~r~n~t Top=" + String(top) + "~r~n~t Right = " &
 + String(right)+ "~r~n~t Bottom = " + String(bottom))
mle_1.text = strDisplay

See also