HP Dx9000 Resources for Developing Touch-Friendly Applications for HP Business - Page 18
Register to receive touch input messages, Handle the messages
UPC - 884420541578
View all HP Dx9000 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 18 highlights
Register to receive touch input messages: LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; PAINTSTRUCT ps; HDC hdc; switch (message) { // pass touch messages to the touch handler case WM_TOUCH: OnTouch(hWnd, wParam, lParam); break; Handle the messages: LRESULT OnTouch(HWND hWnd, WPARAM wParam, LPARAM lParam ){ BOOL bHandled = FALSE; UINT cInputs = LOWORD(wParam); PTOUCHINPUT pInputs = new TOUCHINPUT[cInputs]; if (pInputs){ if (GetTouchInputInfo((HTOUCHINPUT)lParam, cInputs, pInputs, sizeof(TOUCHINPUT))){ for (UINT i=0; i < cInputs; i++){ TOUCHINPUT ti = pInputs[i]; //do something with each touch input entry } bHandled = TRUE; }else{ /* handle the error here */ } delete [] pInputs; }else{ /* handle the error here, probably out of memory */ } 18