Code:
EXPORT LRESULT CALLBACK KBHookProc(int Code, WPARAM wParam, LPARAM lParam)
{
char yesno=0;
if (Code < 0)
return(CallNextHookEx(kbhook, Code, wParam, lParam));
if (lParam & (1 << 30)) // Check whether key was pressed(not released) 31 = key up, 30 = key down
{ // check if the key is one of the number keys (number row or 10-key)
if(((wParam>=48) && (wParam<=57)) || ((wParam>=96) && (wParam<=105)))
{
switch(wParam)
{
case 48: // 0 on num row
case 96: // 0 on 10-key
yesno = MessageBox(NULL, "You pressed 0\nIs this what you want?",
"Are you sure?", MB_YESNO + MB_ICONQUESTION);
break;
case 49: // 1 on num row
case 97: // 1 on 10-key
yesno = MessageBox(NULL, "You pressed 1\nIs this what you want?",
"Are you sure?", MB_YESNO + MB_ICONQUESTION);
break;
case 50: // 2 on num row
case 98: // 2 on 10-key
yesno = MessageBox(NULL, "You pressed 2\nIs this what you want?",
"Are you sure?", MB_YESNO + MB_ICONQUESTION);
break;
case 51: // 3 on num row
case 99: // 3 on 10-key
yesno = MessageBox(NULL, "You pressed 3\nIs this what you want?",
"Are you sure?", MB_YESNO + MB_ICONQUESTION);
break;
case 52: // 4 on num row
case 100: // 4 on 10-key
yesno = MessageBox(NULL, "You pressed 4\nIs this what you want?",
"Are you sure?", MB_YESNO + MB_ICONQUESTION);
break;
case 53: // 5 on num row
case 101: // 5 0n 10-key
yesno = MessageBox(NULL, "You pressed 5\nIs this what you want?",
"Are you sure?", MB_YESNO + MB_ICONQUESTION);
break;
case 54: // 6 on num row
case 102: // 6 on 10-key
yesno = MessageBox(NULL, "You pressed 6\nIs this what you want?",
"Are you sure?", MB_YESNO + MB_ICONQUESTION);
break;
case 55: // 7 on num row
case 103: // 7 on 10-key
yesno = MessageBox(NULL, "You pressed 7\nIs this what you want?",
"Are you sure?", MB_YESNO + MB_ICONQUESTION);
break;
case 56: // 8 on num row
case 104: // 8 on 10-key
yesno = MessageBox(NULL, "You pressed 8\nIs this what you want?",
"Are you sure?", MB_YESNO + MB_ICONQUESTION);
break;
case 57: // 9 on num row
case 105: // 9 on 10-key
yesno = MessageBox(NULL, "You pressed 9\nIs this what you want?",
"Are you sure?", MB_YESNO + MB_ICONQUESTION);
break;
default:
break;
}
if(yesno == 7)
return(CallNextHookEx(kbhook, 0, wParam, lParam));
}
}
return(CallNextHookEx(kbhook, Code, wParam, lParam));
}
I searched the boards and couldn't find any information, I may have just missed it, if this is the case then please post a link to that thread. If you know any way I can do this please let me know. Thanks.