2

すべてのタッチ入力がリダイレクトされるように、ポインター入力用に C# WPF ウィンドウを登録しようとしていますが、RegisterPointerInputTarget は、ターゲット ウィンドウ ハンドルが渡されると false を返します。私のコードは次のとおりです

//declarations

namespace WpfApplication1
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        IntPtr hWnd;
        int abc;
        public MainWindow()
        {

            InitializeComponent();
            System.Windows.Interop.WindowInteropHelper windowHwnd = new System.Windows.Interop.WindowInteropHelper(this);
            hWnd = windowHwnd.EnsureHandle();
            hWnd = windowHwnd.Handle;
            Minimize.Enable(this);
            this.abc = IWrapper.Rpit(hWnd);
        }
        internal class IWrapper
        {
            const string SHADOW_DLL_NAME = "RPIT_TEST.dll";

            [DllImport(SHADOW_DLL_NAME)]
            public static extern int Rpit(IntPtr hwnd);
        }

    }
}

また、RegisterPointerInputTarget 関数は、RPIT_TEST.dll で (c++ 関数として) 次のように定義されています。

extern "C" int __declspec (dllexport) __stdcall Rpit(HWND hwnd)
        {
                typedef enum tagPOINTER_INPUT_TYPE { 
                PT_POINTER  = 0x00000001,
            PT_TOUCH    = 0x00000002,
            PT_PEN      = 0x00000003,
            PT_MOUSE    = 0x00000004
            } POINTER_INPUT_TYPE;
            return RegisterPointerInputTarget(hwnd,PT_POINTER);
        }

私は考えられるエラーをたくさん検索しました。

4

1 に答える 1

1

アプリケーションに署名し、マニフェスト ファイルで uiAccess フラグを true に設定する必要があります。

 <requestedExecutionLevel level="requireAdministrator" uiAccess="true" />

詳細については、こちらをご覧ください。http://msdn.microsoft.com/en-us/library/windows/desktop/ee671610(v=vs.85).aspx

于 2013-09-19T12:37:12.787 に答える