Click here to Skip to main content
15,889,825 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Include issues Pin
gamefreak229128-Mar-09 22:22
gamefreak229128-Mar-09 22:22 
GeneralRe: Include issues Pin
Stuart Dootson28-Mar-09 22:48
professionalStuart Dootson28-Mar-09 22:48 
GeneralRe: Include issues Pin
gamefreak229129-Mar-09 10:07
gamefreak229129-Mar-09 10:07 
GeneralRe: Include issues Pin
Stuart Dootson29-Mar-09 10:10
professionalStuart Dootson29-Mar-09 10:10 
GeneralRe: Include issues Pin
gamefreak229129-Mar-09 10:17
gamefreak229129-Mar-09 10:17 
GeneralRe: Include issues Pin
Stuart Dootson29-Mar-09 10:30
professionalStuart Dootson29-Mar-09 10:30 
GeneralRe: Include issues Pin
gamefreak229129-Mar-09 11:02
gamefreak229129-Mar-09 11:02 
GeneralRe: Include issues Pin
Stuart Dootson29-Mar-09 11:37
professionalStuart Dootson29-Mar-09 11:37 
gamefreak2291 wrote:
I'm thinking that the keyboard hook is not going to work with MessageBoxes


The keyboard hook works OK - the BlockInput, however, doesn't. You can, however, simulate BlockInput by using keyboard and mouse hooks to stop messages getting through - this code stops mouse and keyboard messages being sent to the message box:

HHOOK myKeyboardHook = 0;
HHOOK myMouseHook = 0;
bool blocking = false;

LRESULT CALLBACK KeyboardFilter(int nCode, WPARAM wParam, LPARAM lParam)
{
   if (nCode < 0) return CallNextHookEx(myKeyboardHook, nCode, wParam, lParam);
   if (wParam == 'a' || wParam == 'A')
      blocking = true;
   else if (wParam == 'b' || wParam == 'B')
      blocking = false;
   if (blocking) return 1;
   return CallNextHookEx(myKeyboardHook, nCode, wParam, lParam);
}

LRESULT CALLBACK MouseFilter(int nCode, WPARAM wParam, LPARAM lParam)
{
   if (nCode < 0 || !blocking) return CallNextHookEx(myMouseHook, nCode, wParam, lParam);
   return 1;
}
void StartBlockingFilter()
{
   myKeyboardHook = ::SetWindowsHookEx(WH_KEYBOARD, &KeyboardFilter, 0, GetCurrentThreadId());
   myMouseHook = ::SetWindowsHookEx(WH_MOUSE, &MouseFilter, 0, GetCurrentThreadId());
}

void FinishBlockingFilter()
{
   ::UnhookWindowsHookEx(myKeyboardHook);
   ::UnhookWindowsHookEx(myMouseHook);
}


Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

GeneralRe: Include issues Pin
gamefreak229129-Mar-09 12:22
gamefreak229129-Mar-09 12:22 
GeneralRe: Include issues Pin
Stuart Dootson29-Mar-09 12:27
professionalStuart Dootson29-Mar-09 12:27 
GeneralRe: Include issues Pin
gamefreak229129-Mar-09 17:22
gamefreak229129-Mar-09 17:22 
Questionusing Container template class. new to containers help please Pin
Brandon Ramirez28-Mar-09 18:14
Brandon Ramirez28-Mar-09 18:14 
AnswerRe: using Container template class. new to containers help please Pin
Garth J Lancaster28-Mar-09 20:09
professionalGarth J Lancaster28-Mar-09 20:09 
GeneralRe: using Container template class. new to containers help please Pin
Stuart Dootson28-Mar-09 22:08
professionalStuart Dootson28-Mar-09 22:08 
GeneralRe: using Container template class. new to containers help please Pin
Garth J Lancaster28-Mar-09 23:03
professionalGarth J Lancaster28-Mar-09 23:03 
GeneralRe: using Container template class. new to containers help please Pin
Brandon Ramirez30-Mar-09 4:54
Brandon Ramirez30-Mar-09 4:54 
Questionthe date-elapsing dialog box for the trial version software Pin
Jonathan M Malowitz28-Mar-09 12:05
Jonathan M Malowitz28-Mar-09 12:05 
AnswerRe: the date-elapsing dialog box for the trial version software Pin
«_Superman_»28-Mar-09 18:09
professional«_Superman_»28-Mar-09 18:09 
QuestionHow to add Vertical and Horizontal scrollbars to a CListBox Pin
V K 228-Mar-09 7:05
V K 228-Mar-09 7:05 
AnswerRe: How to add Vertical and Horizontal scrollbars to a CListBox Pin
Hamid_RT28-Mar-09 9:09
Hamid_RT28-Mar-09 9:09 
Questionc++ code required for this small study program Pin
sexinthecity28-Mar-09 4:00
sexinthecity28-Mar-09 4:00 
AnswerRe: c++ code required for this small study program Pin
CPallini28-Mar-09 4:22
mveCPallini28-Mar-09 4:22 
GeneralRe: c++ code required for this small study program Pin
Garth J Lancaster28-Mar-09 23:08
professionalGarth J Lancaster28-Mar-09 23:08 
RantRe: c++ code required for this small study program Pin
Maximilien28-Mar-09 11:06
Maximilien28-Mar-09 11:06 
AnswerRe: c++ code required for this small study program Pin
Joe Woodbury28-Mar-09 16:02
professionalJoe Woodbury28-Mar-09 16:02 

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.