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

C / C++ / MFC

 
QuestionSHADOW COPY IN C Pin
ADELMAR3E29-Mar-09 2:48
ADELMAR3E29-Mar-09 2:48 
QuestionRe: SHADOW COPY IN C Pin
David Crow29-Mar-09 12:35
David Crow29-Mar-09 12:35 
QuestionInclude issues Pin
gamefreak229128-Mar-09 19:02
gamefreak229128-Mar-09 19:02 
AnswerRe: Include issues Pin
Garth J Lancaster28-Mar-09 20:39
professionalGarth J Lancaster28-Mar-09 20:39 
GeneralRe: Include issues Pin
gamefreak229128-Mar-09 22:01
gamefreak229128-Mar-09 22:01 
AnswerRe: Include issues Pin
Stuart Dootson28-Mar-09 22:15
professionalStuart Dootson28-Mar-09 22:15 
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 
The thing is that BlockInput only blocks the input queue of the thread it's executed in - at least that's what the documentation[^] says, so your separate process implementation can't work, as it can only block its own input.

Also - a keyboard hook doesn't need a DLL if it's just for your current thread. The following code adds a hook to the calling thread that blocks input if the 'A' key is pressed. To activate it, you just need to call the StartBlockingFilter function.

HHOOK myHook = 0;

LRESULT CALLBACK KeyboardFilter(int code, WPARAM wParam, LPARAM lParam)
{
   if (wParam == 'a' || wParam == 'A')
      BlockInput(TRUE);
   return CallNextHookEx(myHook, code, wParam, lParam);
}

void StartBlockingFilter()
{
   myHook = ::SetWindowsHookEx(WH_KEYBOARD, &KeyboardFilter, 0, GetCurrentThreadId());
}

void FinishBlockingFilter()
{
   BlockInput(FALSE);
   ::UnhookWindowsHookEx(myHook);
}


You could put this code in a .cpp file, #include it and call StartBlockingFilter from where it was included.

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

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 
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 

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.