SetGestureConfig function
2013-05-04 13:48
253 查看
Configures the messages that are sent from a window for Windows Touch gestures.
dwReserved [in]This value is reserved and must be set to 0.
cIDs [in]A count of the gesture configuration structures that are being passed.
pGestureConfig [in]An array of gesture configuration structures that specify the gesture configuration.
cbSize [in]The size of the gesture configuration (GESTURECONFIG) structure.
If the function fails, the return value is zero. To get extended error information, use the GetLastError function.
The following table shows the identifiers for gestures that are supported by the dwID member of the GESTURECONFIG structure. Note that setting dwID to 0 indicates that global gesture configuration flags are set.
The following flags are used when dwID is set to zero.
The following flags are used when dwID is set to GID_ZOOM.
The following flags are used when dwID is set to GID_PAN.
Note Pan gestures can be used in conjunction with each other to control behavior. For example, setting the dwWant bits to panning with single-finger horizontal and setting the dwBlock bits to single-finger vertical will restrict panning to horizontal pans. Changing the dwWant bit to have
The following flags are used when dwID is set to GID_TWOFINGERTAP.
The following flags are used when dwID is set to GID_PRESSANDTAP.
Note Calling SetGestureConfig will change the gesture configuration for the lifetime of the Window, not just for the next gesture.
Note You should explicitly set all the flags that you want enabled or disabled when controlling single-finger panning.
Syntax
BOOL WINAPI SetGestureConfig( _In_ HWND hwnd, _In_ DWORD dwReserved, _In_ UINT cIDs, _In_ PGESTURECONFIG pGestureConfig, _In_ UINT cbSize );
Parameters
hwnd [in]A handle to the window to set the gesture configuration on.dwReserved [in]This value is reserved and must be set to 0.
cIDs [in]A count of the gesture configuration structures that are being passed.
pGestureConfig [in]An array of gesture configuration structures that specify the gesture configuration.
cbSize [in]The size of the gesture configuration (GESTURECONFIG) structure.
Return value
If the function succeeds, the return value is nonzero.If the function fails, the return value is zero. To get extended error information, use the GetLastError function.
Remarks
If you don't expect to change the gesture configuration, call SetGestureConfig at window creation time. If you want to dynamically change the gesture configuration, call SetGestureConfig in response to WM_GESTURENOTIFY messages.The following table shows the identifiers for gestures that are supported by the dwID member of the GESTURECONFIG structure. Note that setting dwID to 0 indicates that global gesture configuration flags are set.
Name | Value | Description |
---|---|---|
GID_ZOOM | 3 | Configuration settings for the zoom gesture. |
GID_PAN | 4 | The pan gesture. |
GID_ROTATE | 5 | The rotation gesture. |
GID_TWOFINGERTAP | 6 | The two-finger tap gesture. |
GID_PRESSANDTAP | 7 | The press and tap gesture. |
Name | Value | Description |
---|---|---|
GC_ALLGESTURES | 0x00000001 | All of the gestures. |
Name | Value | Description |
---|---|---|
GC_ZOOM | 0x00000001 | The zoom gesture. |
Name | Value | Description |
---|---|---|
GC_PAN | 0x00000001 | All pan gestures. |
GC_PAN_WITH_SINGLE_FINGER_VERTICALLY | 0x00000002 | Vertical pans with one finger. |
GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY | 0x00000004 | Horizontal pans with one finger. |
GC_PAN_WITH_GUTTER | 0x00000008 | Panning with a gutter boundary around the edges of pannable region. The gutter boundary limits perpendicular movement to a primary direction until a threshold is reached to break out of the gutter. |
GC_PAN_WITH_INTERTIA | 0x00000010 | Panning with inertia to smoothly slow when pan gestures stop. |
GC_PAN_WITH_SINGLE_FINGER_VERTICALLY | GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLYand removing single-finger vertical pan from the dwBlock bit will enable both vertical and horizontal panning. Note By default, panning has inertia enabled. Note A single call to SetGestureConfig cannot include other GIDs along with 0. The following flags are used when dwID is set to GID_ROTATE.
Name | Value | Description |
---|---|---|
GC_ROTATE | 0x00000001 | The rotation gesture. |
Name | Value | Description |
---|---|---|
GC_TWOFINGERTAP | 0x00000001 | The two-finger tap gesture. |
Name | Value | Description |
---|---|---|
GC_PRESSANDTAP | 0x00000001 | The press and tap gesture. |
Examples
The following example shows how you could receive horizontal and vertical single-finger panning with no gutter and no inertia. This is a typical configuration for a 2-D navigation application such as the Microsoft PixelSense Globe application.// set up our want / block settings DWORD dwPanWant = GC_PAN_WITH_SINGLE_FINGER_VERTICALLY | GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY; DWORD dwPanBlock = GC_PAN_WITH_GUTTER | GC_PAN_WITH_INERTIA; // set the settings in the gesture configuration GESTURECONFIG gc[] = {{ GID_ZOOM, GC_ZOOM, 0 }, { GID_ROTATE, GC_ROTATE, 0}, { GID_PAN, dwPanWant , dwPanBlock} }; UINT uiGcs = 3; BOOL bResult = SetGestureConfig(hWnd, 0, uiGcs, gc, sizeof(GESTURECONFIG)); if (!bResult){ DWORD err = GetLastError(); }The following example shows how to receive single-finger pan gestures and disable gutter panning. This is a typical configuration for applications that scroll text such as Notepad.
Note You should explicitly set all the flags that you want enabled or disabled when controlling single-finger panning.
// set up our want / block settings DWORD dwPanWant = GC_PAN | GC_PAN_WITH_SINGLE_FINGER_VERTICALLY; DWORD dwPanBlock = GC_PAN_WITH_GUTTER; // set the settings in the gesture configuration GESTURECONFIG gc[] = {{ GID_ZOOM, GC_ZOOM, 0 }, { GID_ROTATE, GC_ROTATE, 0}, { GID_PAN, dwPanWant , dwPanBlock} }; UINT uiGcs = 3; BOOL bResult = SetGestureConfig(hWnd, 0, uiGcs, gc, sizeof(GESTURECONFIG)); if (!bResult){ DWORD err = GetLastError(); }The following example shows how you can disable all gestures.
// set the settings in the gesture configuration GESTURECONFIG gc[] = {0,0,GC_ALLGESTURES}; UINT uiGcs = 1; BOOL bResult = SetGestureConfig(hWnd, 0, uiGcs, gc, sizeof(GESTURECONFIG)); if (!bResult){ DWORD err = GetLastError(); }The following example shows how you could enable all gestures.
GESTURECONFIG gc = {0,GC_ALLGESTURES,0}; UINT uiGcs = 1; BOOL bResult = SetGestureConfig(hWnd, 0, uiGcs, &gc, sizeof(GESTURECONFIG)); if (!bResult){ DWORD err = GetLastError(); }The following example shows how you could enable all Windows 7 gestures.
// set the settings in the gesture configuration GESTURECONFIG gc[] = {{ GID_ZOOM, GC_ZOOM, 0 }, { GID_ROTATE, GC_ROTATE, 0}, { GID_PAN, GC_PAN , 0}, { GID_TWOFINGERTAP, GC_TWOFINGERTAP , 0}, { GID_PRESSANDTAP, GC_PRESSANDTAP , 0} }; UINT uiGcs = 5; BOOL bResult = SetGestureConfig(hWnd, 0, uiGcs, gc, sizeof(GESTURECONFIG)); if (!bResult){ DWORD err = GetLastError(); }The following example configuration would set the parent window to enable support for zoom, horizontal pan, and vertical pan while the child window would just support horizontal pan.
// set up our want / block settings for a parent window DWORD dwPanWant = GC_PAN_WITH_SINGLE_FINGER_VERTICALLY | GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY; DWORD dwPanBlock = GC_PAN_WITH_GUTTER | GC_PAN_WITH_INERTIA; // set the settings in the gesture configuration GESTURECONFIG gcParent[] = {{ GID_ZOOM, GC_ZOOM, 0 }, { GID_PAN, dwPanWant , dwPanBlock} }; // Set the pan settings for a child window dwPanWant = GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY; dwPanBlock = GC_PAN_WITH_SINGLE_FINGER_VERTICALLY | GC_PAN_WITH_GUTTER | GC_PAN_WITH_INERTIA; GESTURECONFIG gcChild[] = {{ GID_ZOOM, 0, GC_ZOOM }, { GID_PAN, dwPanWant , dwPanBlock} }; UINT uiGcs = 2; BOOL bResult = FALSE; if (isParent){ bResult = SetGestureConfig(hWnd, 0, uiGcs, gcParent, sizeof(GESTURECONFIG)); }else{ bResult = SetGestureConfig(hWnd, 0, uiGcs, gcChild, sizeof(GESTURECONFIG)); } if (!bResult){ DWORD err = GetLastError(); }
Requirements
Minimum supported client | Windows 7 [desktop apps only] |
---|---|
Minimum supported server | Windows Server 2008 R2 [desktop apps only] |
Header | Winuser.h (include Windows.h) |
Library | User32.lib |
DLL | User32.dll |
相关文章推荐
- SetGestureConfig 函数-中文整理
- GetGestureConfig function
- SetErrorMode Function
- PostgreSQL aggregate function 3 : Aggregate Functions for Ordered-Set
- 虚拟主机运行ASP错误解决:HTTP/1.1 New Application Failed when allowSessionState is set to false in web.config
- You are *required* to use the date.timezone setting or the date_default_timezone_set() function.
- 奇怪的现象:touchesBegan: 与UITapGestureRecognizer手势没有人响应 以及set方法的妙用
- 如何删除npm之前设置的npm config set prefix...
- JMeter 参数化之 CSV Data Set Config
- mysql 创建函数set global log_bin_trust_function_creators=TRUE;
- ExtJS new Ext.form.FormPanel时报错,c.setWidth not is function原因anchor属性,解决方法
- Infinite size of Hypothesis set and growth function
- SetKeyHandler()的流程--SetRightSoftkeyfunction()
- web.config SetAttributes
- symbol lookup error: /usr/bin/suricata: undefined symbol: htp_config_set_query_case_insensitive 解决方法
- GetDefaultCommConfig和SetDefaultCommConfig 传入CString 的GetString 和GetBuffer失败
- Deprecated: Function set_magic_quotes_runtime() is deprecated
- 微信小程序报错:this.setData is not a function的解决办法
- Will a recursive 'setTimeout' function call eventually kill the JS Engine?
- PostgreSQL aggregate function 4 : Hypothetical-Set Aggregate Functions