最終更新:2012-01-06 (金) 15:40:40 (3180d)  

Windows Touch API
Top / Windows Touch API

http://msdn.microsoft.com/en-us/library/dd317323(VS.85).aspx

WM_TOUCH

// ハードがマルチタッチをサポートしているかどうか
int  value= ~GetSystemMetrics( SM_DIGITIZER );
if( !(value & 0xc0) ){
    RegisterTouchWindow( hwnd, 0 );
}

    case WM_TOUCH:
	WM_Touch( mes, wparam, lparam );
	return	FALSE;

void WM_Touch( UINT mes, WPARAM wparam, LPARAM lparam )
{
    int inputs= LOWORD( wparam );
    TOUCHINPUT  tbuf[ 32 ]; // inputs
    HTOUCHINPUT	hinput= reinterpret_cast( lparam );
    if( GetTouchInputInfo( hinput, inputs, tbuf, sizeof(TOUCHINPUT) ) ){
        TOUCHINPUT*  tp= tbuf;
        for( int i= 0 ; i< inputs && i < 32 ; i++, tp++ ){
            ~
	    tp->dwID // 識別
	    tp->x, tp->y // 座標
	    tp->dwFlags // UP/DOWN/MOVE
	}
    }
    CloseTouchInputHandle( hinput );
}

WM_GESTURE

  • GID_ZOOM
  • GID_PAN
  • GID_ROTATE
  • GID_TWOFINGERTAP
  • GID_ROLLOVER
    case WM_GESTURE:
	WM_Gesture( mes, wparam, lparam );
	return	FALSE;


void WM_Gesture( UINT mes, WPARAM wparam, LPARAM lparam )
{
    GESTUREINFO	ginfo;
    memset( &ginfo, 0, sizeof(GESTUREINFO) );
    ginfo.cbSize= sizeof(GESTUREINFO);
    HGESTUREINFO	hgesture= reinterpret_cast<HGESTUREINFO>( lparam );

    if( GetGestureInfo( hgesture, &ginfo ) ){
        ...
    }
    CloseGestureInfoHandle( hgesture );
}

http://msdn.microsoft.com/en-us/library/dd353242(VS.85).aspx

参考