PKEY_EdgeGesture_DisableTouchWhenFullscreen未声明的标识符
PKEY_EdgeGesture_DisableTouchWhenFullscreen undeclared identifier
这是一个vs2010 MFC对话框应用程序。除了下面的代码,我还尝试包括以下库,ehstorguids。自由Uuid.Lib。我的最终目标是消灭windows 8的魅力条。我错过了什么导致这个未声明的标识符。
#include "stdafx.h"
#include <windows.h>
#include <iostream>
#include <propsys.h>
#include <propkey.h>
using namespace std;
HRESULT SetTouchDisableProperty(HWND hwnd, BOOL fDisableTouch)
{
IPropertyStore* pPropStore;
HRESULT hrReturnValue = SHGetPropertyStoreForWindow(hwnd, IID_PPV_ARGS(&pPropStore));
if (SUCCEEDED(hrReturnValue))
{
PROPVARIANT var;
var.vt = VT_BOOL;
var.boolVal = fDisableTouch ? VARIANT_TRUE : VARIANT_FALSE;
hrReturnValue = pPropStore->SetValue(PKEY_EdgeGesture_DisableTouchWhenFullscreen, var);
pPropStore->Release();
}
return hrReturnValue;
}
BOOL CALLBACK MyEnumProc(HWND hWnd, LPARAM lParam)
{
TCHAR title[500];
ZeroMemory(title, sizeof(title));
GetWindowText(hWnd, title, sizeof(title)/sizeof(title[0]));
if (!_tcscmp(title, _T("helloworld")))
{
SetTouchDisableProperty(hWnd,true);
}
return TRUE;
}
void mymfcdialog::ObBnClickedOk()
{
EnumWindows(MyEnumProc, 0);
}
声明需要Windows 8 SDK,即使VS没有抱怨每个MSDN都需要包含的库。
这种隐藏/禁用charm的方法仅适用于桌面应用程序,当它们全屏并有标题栏时。所以在我的例子中,这行不通。当没有需要的魅力条/手势时,终止"资源管理器"进程,然后重新启动资源管理器进程是唯一的选择。如果MS读到这个,你真的应该四处看看,这应该不需要隐藏/禁用Charms/手势。但话说回来,看看windows,看看windows 8……我是说8.1....
你的原始代码在我看来没有错。事实上,网上有这样的例子。
我发现最好的是https://github.com/Kuqd/DisableCharmBar,它演示了一个工作示例。
您在自己的回答中提到的关于窗口标题栏的限制可能与您的GetWindowText
检查有关。Kuqd的例子没有标题栏。
我在我的代码中使用这个,我希望它能帮助你:
static Guid DISABLE_TOUCH_SCREEN = new Guid("32CE38B2-2C9A-41B1-9BC5-B3784394AA44"), // PKEY_EdgeGesture_DisableTouchWhenFullscreen
IID_PROPERTY_STORE = new Guid("886d8eeb-8cf2-4446-8d02-cdba1dbdcf99"); // PropertyStore
static short VT_BOOL = 11;
private const int GC_ALLGESTURES = 0x00000001;
public static void DisableEdgeGestures(IntPtr hwnd)
{
win32.IPropertyStore pPropStore = null;
int hr = 0;
hr = win32.SHGetPropertyStoreForWindow(hwnd, ref IID_PROPERTY_STORE, out pPropStore);
if (hr == 0)
{
win32.PropertyKey propKey = new win32.PropertyKey();
propKey.fmtid = DISABLE_TOUCH_SCREEN;
propKey.pid = 2;
win32.PropVariant var = new win32.PropVariant();
var.vt = VT_BOOL;
var.boolVal = true;
pPropStore.SetValue(ref propKey, ref var);
System.Runtime.InteropServices.Marshal.FinalReleaseComObject(pPropStore);
}
}
相关文章:
- #ifdef和未声明的标识符
- 未声明的标识符编译暗黑破坏神 2 程序"muleview"
- 在顶点着色器中使用 OpenGl 的未声明标识符,我在顶点着色器中绘制三角形时遇到问题
- Google protobuf 时间戳未声明标识符,在 Windows 上具有C++
- 使用未声明的标识符"sqrt"?
- 对类 (C++) 中的私有变量使用未声明的标识符
- 我的代码中有错误,未声明的标识符
- 未定义的标识符/未声明
- 错误:在 C++ 'std'使用未声明的标识符
- 在编译器之前检测未声明的标识符
- 使用未声明的标识符'temp'
- 使用未声明的标识符"yylex"和"yyin"?
- 使用"class"关键字,后跟未声明的标识符
- 未声明的标识符错误,但变量定义正确 (?)
- C2065 'cout':未声明的标识符
- C++模板模板参数中未声明的标识符
- 错误:在 C++ 目标 c 混合'self'使用未声明的标识符
- C++循环依赖关系,未声明的标识符
- 我的函数调用 (C++) 中的未声明标识符
- 未找到标识符和未声明的标识符