LRESULT CMIDIKeyboard::OnTouchMessage( WPARAM wParam, LPARAM lParam ){ //Insert handler code here to do something with the message //or uncomment the following line to test //-------------------saurabh code----------------------------------- // Number of actual per-contact messages UINT cInputs = (int) wParam; // Allocate the storage for the parameters of the per-contact messages TOUCHINPUT* pInputs = new TOUCHINPUT[cInputs]; if (pInputs == NULL) { return 0; } // Unpack message parameters into the array of TOUCHINPUT structures, each // representing a message for one single contact. if (GetTouchInputInfo((HTOUCHINPUT)lParam, cInputs, pInputs, sizeof(TOUCHINPUT))) { // For each contact, dispatch the message to the appropriate message // handler. for (unsigned int i = 0; i < cInputs; i++) { if (pInputs[i].dwFlags & TOUCHEVENTF_DOWN) { CPoint point; CRect rect; GetClientRect(&rect); point=CPoint(pInputs[i].x- rect.left,pInputs[i].y-rect.top); m_CurrKey= CPianoCtrl::FindKey(point); m_Keys[m_CurrKey]- >NoteOn(m_NoteOnColor,rect); NotifyNoteOn(m_LowNote+m_CurrKey); findchords(m_LowNote+m_CurrKey); InvalidateRect(&rect); CWnd::OnTouchMessage(wParam,lParam); } else if (pInputs[i].dwFlags & TOUCHEVENTF_UP) { //MessageBox("touchup!", "touchup!", MB_OK); // g_pIManipProc->ProcessUp(pInputs[i].dwID, (FLOAT)pInputs[i].x, (FLOAT)pInputs[i].y); } else if (pInputs[i].dwFlags & TOUCHEVENTF_MOVE) { //MessageBox("touchmove!", "touchmove!", MB_OK); //g_pIManipProc->ProcessMove(pInputs[i].dwID, (FLOAT)pInputs[i].x, (FLOAT)pInputs[i].y); } } } else { // error handling, presumably out of memory ASSERT(FALSE && L"Error: failed to execute GetTouchInputInfo"); delete [] pInputs; return 0; //break; } if (!CloseTouchInputHandle((HTOUCHINPUT)lParam)) { // error handling, presumably out of memory ASSERT(FALSE && L"Error: failed to execute CloseTouchInputHandle"); delete [] pInputs; return 0; //break; } delete [] pInputs; //--------------------------------------------------------saurabh code ends----------------- //MessageBox("touch!", "touch!", MB_OK); return 0; }
// ---------------------- // | | || | | | || || | | // | |_||_| | |_||_||_| | // | | | | | | | | // ---------------------- // ^ ^ | | one point More than touch one touch
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)