Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How do I using WH_CALLWNDPROC and PT_TOUCH to get the global touch event

How do I using WH_CALLWNDPROC and PT_TOUCH to get the global touch event

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelp
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cedricvictor
    wrote on last edited by
    #1

    Dear all: I try to use WH_CALLWNDPROC and PT_TOUCH in dll to get the global touch event. But I get some problems. My code lists as below:

    #pragma data_seg (".SHARED")
    HHOOK g_hPreviousMouseHook = 0;
    HINSTANCE g_hInstance = 0;
    #pragma data_seg()
    #pragma comment(linker, "/SECTION:.SHARED,RWS")

    BOOL CSoundDllApp::InitInstance()
    {
    CWinApp::InitInstance();
    g_hInstance = AfxGetInstanceHandle();
    return TRUE;
    }

    BOOL InstallWinHook()
    {
    BOOL bReturn = TRUE;
    g_hPreviousMouseHook = SetWindowsHookEx(WH_CALLWNDPROC,
    &WinHookProcedure, g_hInstance, 0);

    if(NULL == g\_hPreviousMouseHook)
    {
        bReturn = FALSE;
    }
    return bReturn;
    

    }

    BOOL UnInstallWinHook()
    {
    BOOL bReturn = TRUE;
    if(UnhookWindowsHookEx(g_hPreviousMouseHook) == FALSE)
    {
    bReturn = FALSE;
    }
    return bReturn;
    }

    LRESULT CALLBACK WinHookProcedure(int nCode, WPARAM wParam, LPARAM lParam)
    {
    if(0 > nCode)
    return CallNextHookEx(g_hPreviousMouseHook, nCode,
    wParam, lParam);
    UINT32 pointerId = GET_POINTERID_WPARAM(wParam);
    POINTER_INPUT_TYPE pointerType;

    if(GetPointerType(pointerId, &pointerType))  
    {
    //if (pointerType == PT\_TOUCH)   
    //{  
    //}  
    }
    return CallNextHookEx(g\_hPreviousMouseHook, nCode, wParam,   
                                                 lParam);
    

    }

    When I disable the GetPointerType(pointerId, &pointerType) in WinHookProcedure, it will load the dll success. When I enable the GetPointerType(pointerId, &pointerType) in WinHookProcedure, it will load the dll failed. what happened? Could someone tell me please? Thanks for your help, Victor

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups