IInkDisp::CreateStroke
4/8/2010
Creates an IInkStrokeDisp object for the IInkDisp object from an array of packet data input values.
Syntax
HRESULT CreateStroke (
[in] VARIANT packetData,
[in] VARIANT packetDescription,
[out, retval] IInkStrokeDisp **Stroke
);
Parameters
packetData
[in] Specifies the array of packet data. The data is an array of Int32 (Long in Visual Basic) values which, taken in order, form the array of points (x0, y0), (x1, y1), which is passed into the method within a Variant. See the following code sample for more information about how to do this.For more information about the VARIANT structure, see Using the Automation Library with Windows Mobile Ink.
- packetDescription
[in] A reserved parameter that is not implemented for Windows Mobile.
- Stroke
[out, retval] Returns the newly created stroke.
Return Value
- S_OK
Success.
- E_POINTER
A parameter contained an invalid pointer.
- E_INVALIDARG
Invalid VARIANT type (only VT_ARRAY | VT_I4 supported).
- E_INK_EXCEPTION
An exception occurred inside the method.
- E_OUTOFMEMORY
Cannot allocate memory to create the new stroke.
Remarks
The minimum and maximum values of any point in the points array are LONG_MIN and LONG_MAX, respectively. However, these points define an ink space rectangle whose maximum width or height cannot exceed LONG_MAX. Because of this, the difference between the minimum and maximum x–coordinates, or the minimum and maximum y–coordinates, cannot exceed LONG_MAX.
Example
VARIANT var, varPK;
LONG* plongArray=NULL;
POINT ptArray[2]={0};
long lSize=0;
IInkStrokeDisp* pInkStrokeDisp;
IInkDisp* pInk; // the object should be created correctly
// elsewhere and assigned here.
HRESULT hr=E_FAIL;
ptArray[0].x = 20;
ptArray[0].y = 100;
ptArray[1].x = 30;
ptArray[1].y = 110;
lSize = 2; // two points
VariantInit( &var );
VariantInit( &varPK );
SAFEARRAY* psa = SafeArrayCreateVector( VT_I4, 0, lSize*2 );
if( psa )
{
if( SUCCEEDED( hr = SafeArrayAccessData( psa, (void**)&plongArray) ))
{
for( long i = 0; i < lSize; i++ )
{
plongArray[2*i] = ptArray[i].x;
plongArray[2*i+1] = ptArray[i].y;
}
hr = SafeArrayUnaccessData( psa );
if ( SUCCEEDED( hr ) )
{
var.vt = VT_ARRAY | VT_I4;
var.parray = psa;
// varPK (packet description) is currently reserved, so it is
// just empty variant for now.
pInk->CreateStroke( var, varPK, &pInkStrokeDisp );
}
}
}
VariantClear( &var );
VariantClear( &varPK );
Requirements
Header | msinkaut.h |
Windows Embedded CE | Windows CE 5.0 and later |
Windows Mobile | Windows Mobile 6 Classic and later, Windows Mobile 6 Professional and later |