ITablet::CreateContext method

Creates a context object that describes the specified tablet device.

Syntax

HRESULT CreateContext(
  [in]      HWND                    hWnd,
  [in]      RECT                    *prcInput,
  [in]      DWORD                   dwOptions,
  [in]      TABLET_CONTEXT_SETTINGS *pTCS,
  [in]      CONTEXT_ENABLE_TYPE     cet,
  [out]     ITabletContext          **ppCtx,
  [in, out] TABLET_CONTEXT_ID       *pTcid,
  [in, out] PACKET_DESCRIPTION      **ppPD,
  [in]      ITabletEventSink        *pSink
);

Parameters

hWnd [in]

The window to which the tablet context will be attached.

prcInput [in]

[in, unique]

The ink input rectangle.

dwOptions [in]

Flags that set tablet context options.

pTCS [in]

[in, unique]

Detailed information about the tablet context to create.

cet [in]

Value that enables or disables context messages being sent to the window.

ppCtx [out]

A pointer to the newly create tablet context.

pTcid [in, out]

Value that uniquely identifies the tablet.

ppPD [in, out]

Pointer to information about what data is contained in each packet.

pSink [in]

The ITabletEventSink object where notification messages will be sent.

Return value

This method can return one of these values.

Return code Description
S_OK
Success.
E_FAIL
An unspecified error occurred.

Remarks

Typically, an application obtains the default values from the ITablet::GetDefaultContextSettings Method, modifies values to suit their needs, and then passes the modified settings structure to the ITablet::CreateContext Method.

Note

You must implement the ITabletEventSink Interface when calling the ITablet::CreateContext Method.

The dwOptions parameter is a set of bit flags that describe context options. The following table describes these flags.

Flag Name Value Description
TCXO_MARGIN
0x00000001
Specifies that the input context on the tablet will have a margin. The margin is an area outside the specified input area where events will be mapped to the edge of the input area. This feature makes it easier to input points at the edge of the context.
TCXO_PREHOOK
0x00000002
Prehook gets packets before regular contexts and posthooks. They get packets in the order of their creation.
TCXO_CURSOR_STATE
0x00000004
The TC will return packets even if the cursor is up. By default, a TC will only return packets when the cursor is down.
TCXO_NO_CURSOR_DOWN
0x00000008
The TC will not return packets when the cursor is down.
TCXO_NON_INTEGRATED
0x00000010
The context will be non-integrated.
TCXO_POSTHOOK
0x00000020
Posthooks get packets after regular tablet contexts but before the system context. They get packets in the reverse order of their creation.
TCXO_DONT_SHOW_CURSOR
0x00000080
The TC will not set the cursor position.
TCXO_DONT_VALIDATE_TCS
0x00000100
The TC will not validate the GUIDS passed in the tablet context settings against the supported properties of the device.
TCXO_ALLOW_FLICKS
0x00000400
The TC will allow flick detection to take place (by default this is only allowed on system contexts), and the client will get SE_FLICK events.
TCXO_ALLOW_FEEDBACK_TAPS
0x00000800
The TC will allow pen feedback to be shown. By default, this is only allowed on system contexts.
TCXO_ALLOW_FEEDBACK_BARREL
0x00001000
The TC will allow pen feedback to be shown. By default, this is only allowed on system contexts.
TCXO_ALL
TCXO_MARGIN | TCXO_PREHOOK | TCXO_CURSOR_STATE | TCXO_NO_CURSOR_DOWN | TCXO_NON_INTEGRATED | TCXO_POSTHOOK | TCXO_DONT_SHOW_CURSOR | TCXO_DONT_VALIDATE_TCS
All defined tablet context options.
TCXO_HOOK
TCXO_PREHOOK | TCXO_POSTHOOK
Combines pre-hook and post-hook functionality.

Requirements

Requirement Value
Minimum supported client
Windows XP Tablet PC Edition [desktop apps only]
Minimum supported server
None supported
Library
Wisptis.exe

See also

ITablet Interface

CONTEXT_ENABLE_TYPE Enumeration

TABLET_CONTEXT_SETTINGS Structure

PACKET_DESCRIPTION Structure

ITabletContextP Interface

ITabletEventSink Interface