StartInking 

2.0     

Starts inking feedback while pen input is being collected.

int StartInking( HPCM hpcm, UINT idEvent, LPINKINGINFO lpinkinginfo )

Parameters

hpcm

Handle to the current collection. This is the return value from StartPenInput1AOCU6.

idEvent

The identifier of the packet at which to start inking.

lpinkinginfo

Address of an INKINGINFO1AOCW_ structure, used to specify the characteristics of the ink. This parameter can be NULL to use the default ink characteristics. Otherwise, the structure s cbSize member must be initialized with sizeof( INKINGINFO ).

Return Value

Returns PCMR_OK if inking started successfully; otherwise, returns one of the following:

Constant

Description

PCMR_DISPLAYERR

There is no display device, or it was unable to ink at this time, or there was an error in setting the pen-tip characteristics.

PCMR_ERROR

The INKINGINFO1AOCW_ structure contains invalid values, or there was some other unspecified error.

PCMR_INVALIDCOLLECTION

The hpcm handle is invalid because the calling application did not start input by calling StartPenInput1AOCU6.

PCMR_INVALID_PACKETID

The idEvent parameter is invalid.

 

Comments

An application calls StartInking to track pen movement while the pen tip is down. When pen input is started by calling the StartPenInput1AOCU6 function, Windows initializes the internal INKINGINFO1AOCW_ structure as follows:

    The wFlags member is set to PII_INKPENTIP | PII_INKCLIPRECT.

    The tip member is set to the system default pen tip, as obtained by calling the GetPenMiscInfo1AOBY9 function.

    The rectClip member is set to the client area, in screen coordinates, of the window that was used in the call to the StartPenInput function.

 

The first call to StartInking with the lpinkinginfo parameter set to NULL starts inking with the settings listed above. If the calling application uses a non-NULL value for lpinkinginfo, the appropriate internal inking parameters are modified before inking starts, depending on the flags set in the wFlags member of the INKINGINFO structure.

Whenever StartInking is called, the current settings of the internal inking structure are added to or replaced. Specific values must be set in the members of INKINGINFO1AOCW_ to disable them. Refer to the description of each member in the INKINGINFO structure for these values.

If a region is passed in for clipping or stopping the ink, the application must destroy the region. Since a copy is made, the region can be destroyed immediately following the call to StartInking. The application can specify either a clip region or a clip rectangle. Specifying both will result in the clip rectangle being ignored.

Example

The following code example changes the inking tip from the default (as set by a call to StartPenInput1AOCU6) to red ink, 5 pixels wide. It also adds an inkstop rectangle (inking stops if the pen touches down inside the inkstop rectangle). The clipping rectangle remains unchanged from the default settings.

INKINGINFO inkinginfo;

 

inkinginfo.cbSize           = sizeof( INKINGINFO );

inkinginfo.wFlags           = PII_INKPENTIP | PII_INKSTOPRECT;

inkinginfo.tip.cbSize       = sizeof( PENTIP );

inkinginfo.tip.rgb          = RGB( 255,0,0 );

inkinginfo.tip.bwidth       = 5;

inkinginfo.rectInkStop.left = rectInkTop.top = 0;

inkinginfo.rectInkStop.right = rectInkTop.bottom = 100;

 

ClientToScreen( hwnd, (LPPOINT)&(inkinginfo.rectInkStop) );

ClientToScreen( hwnd, (LPPOINT)&(inkinginfo.rectInkStop.right) );

StartInking( hpcm, wEventRef, &inkinginfo );

 

See Also

INKINGINFO, StartPenInput, StopInking