Click here to Skip to main content
15,900,816 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: reading stdout Pin
Chris Losinger3-Apr-14 7:17
professionalChris Losinger3-Apr-14 7:17 
GeneralRe: reading stdout Pin
Albert Holguin3-Apr-14 7:26
professionalAlbert Holguin3-Apr-14 7:26 
AnswerRe: reading stdout Pin
Randor 3-Apr-14 8:37
professional Randor 3-Apr-14 8:37 
QuestionAre MFC Timer(s) bad for performance in large projects (Vc++) Pin
C3D13-Apr-14 2:23
professionalC3D13-Apr-14 2:23 
AnswerRe: Are MFC Timer(s) bad for performance in large projects (Vc++) Pin
Albert Holguin3-Apr-14 3:33
professionalAlbert Holguin3-Apr-14 3:33 
AnswerRe: Are MFC Timer(s) bad for performance in large projects (Vc++) Pin
Stefan_Lang3-Apr-14 3:52
Stefan_Lang3-Apr-14 3:52 
GeneralRe: Are MFC Timer(s) bad for performance in large projects (Vc++) Pin
Albert Holguin3-Apr-14 4:06
professionalAlbert Holguin3-Apr-14 4:06 
GeneralRe: Are MFC Timer(s) bad for performance in large projects (Vc++) Pin
Heng Xiangzhong7-Apr-14 19:34
Heng Xiangzhong7-Apr-14 19:34 
GeneralRe: Are MFC Timer(s) bad for performance in large projects (Vc++) Pin
Stefan_Lang7-Apr-14 21:35
Stefan_Lang7-Apr-14 21:35 
GeneralRe: Are MFC Timer(s) bad for performance in large projects (Vc++) Pin
Heng Xiangzhong7-Apr-14 23:17
Heng Xiangzhong7-Apr-14 23:17 
GeneralRe: Are MFC Timer(s) bad for performance in large projects (Vc++) Pin
Stefan_Lang7-Apr-14 23:49
Stefan_Lang7-Apr-14 23:49 
GeneralRe: Are MFC Timer(s) bad for performance in large projects (Vc++) Pin
Heng Xiangzhong8-Apr-14 0:56
Heng Xiangzhong8-Apr-14 0:56 
GeneralRe: Are MFC Timer(s) bad for performance in large projects (Vc++) Pin
Stefan_Lang8-Apr-14 1:39
Stefan_Lang8-Apr-14 1:39 
GeneralRe: Are MFC Timer(s) bad for performance in large projects (Vc++) Pin
Heng Xiangzhong8-Apr-14 2:04
Heng Xiangzhong8-Apr-14 2:04 
QuestionAdd MFC support to ATL COM DLL project Pin
john56322-Apr-14 23:53
john56322-Apr-14 23:53 
AnswerRe: Add MFC support to ATL COM DLL project Pin
Richard MacCutchan3-Apr-14 0:01
mveRichard MacCutchan3-Apr-14 0:01 
GeneralRe: Add MFC support to ATL COM DLL project Pin
john56323-Apr-14 1:18
john56323-Apr-14 1:18 
GeneralRe: Add MFC support to ATL COM DLL project Pin
Richard MacCutchan3-Apr-14 1:29
mveRichard MacCutchan3-Apr-14 1:29 
GeneralRe: Add MFC support to ATL COM DLL project Pin
john56323-Apr-14 1:54
john56323-Apr-14 1:54 
GeneralRe: Add MFC support to ATL COM DLL project Pin
Richard MacCutchan3-Apr-14 2:51
mveRichard MacCutchan3-Apr-14 2:51 
QuestionHow to know no message in WindowProc callback function? Pin
cedricvictor2-Apr-14 16:34
cedricvictor2-Apr-14 16:34 
Dear all:

I use two global variables UINT g_PreUsedSize and g_CurUsedSize in WindowProc callback function.

When I touch on my device, I will get WM_INPUT message continuous in WindowProc callback function,

and get a result->active_touch_count, and set it to g_CurUsedSize.


When I did not touch on my device, I wanna set 0 to g_CurUsedSize.

C++
LRESULT CALLBACK WindowProc (HWND window_handle, UINT message, WPARAM w_param, LPARAM l_param)
{
   LRESULT result (0);

   switch (message)
   {
      case WM_DESTROY:
         PostQuitMessage (0); 
         break;

      case WM_SIZE:
         {
            switch (w_param)
            {
               case SIZE_MAXIMIZED:
               case SIZE_RESTORED:
               {
                   window_width = (float)(LOWORD (l_param));
                   window_height = (float)(HIWORD (l_param));
               }
               break;
            }
         }
         break;

        case WM_INPUT:
        {		
            UINT data_size (0);
            GetRawInputData ((HRAWINPUT)l_param, RID_INPUT,NULL, &data_size, sizeof (RAWINPUTHEADER));
            
            vector<BYTE> data;
            data.resize (data_size);

            if (GetRawInputData ((HRAWINPUT)l_param, RID_INPUT, &data [0], &data_size, sizeof(RAWINPUTHEADER)) != data_size)
            {
                OutputDebugString(TEXT("GetRawInputData does not return correct size !\n")); 
                break;
            }
              
            RAWINPUT* raw = (RAWINPUT*)(&data [0]);
           
            if (raw->header.dwType == RIM_TYPEHID) 
            {
                RID_DEVICE_INFO device_info;
	       UINT info_size = sizeof(RIDI_DEVICEINFO);
	       GetRawInputDeviceInfo ( raw->header.hDevice, RIDI_DEVICEINFO, (LPVOID)&device_info, &info_size);
				   
	       if(device_info.hid.dwVendorId = 0x0457)
	       {
     	           DigitizerData* result = (DigitizerData*)(raw->data.hid.bRawData);
					
                    g_CurUsedSize = result->active_touch_count;	
				
         	           BOOL bGot = FALSE;

		  if(g_CurUsedSize <= 5)
		  {
		      if(g_PreUsedSize <  g_CurUsedSize)
		      {
		        PlaySound(TEXT("C:\\default.wav"),NULL, SND_FILENAME|SND_ASYNC );
	              }
	          }
		  bGot = TRUE;
	       }
	   }

	   if(bGot)
	   {
              g_PreUsedSize =  g_CurUsedSize;
	   }
         }				 
     }
     result = DefWindowProc (window_handle, message, w_param, l_param);
 }
         break;

      default: 
         result = DefWindowProc (window_handle, message, w_param, l_param);
         break;
   }
   return result;
}



My question is:

1. How do I know my device send no data in WindowProc, if I did not touch?

Thank for your help, Victor
AnswerRe: How to know no message in WindowProc callback function? Pin
Richard MacCutchan2-Apr-14 21:32
mveRichard MacCutchan2-Apr-14 21:32 
QuestionImage processing discussion forum? Pin
Vaclav_31-Mar-14 8:49
Vaclav_31-Mar-14 8:49 
AnswerRe: Image processing discussion forum? Pin
SoMad31-Mar-14 9:55
professionalSoMad31-Mar-14 9:55 
AnswerRe: Image processing discussion forum? Pin
Chris Losinger31-Mar-14 10:37
professionalChris Losinger31-Mar-14 10:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.