Click here to Skip to main content
15,922,015 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: SSE Pin
l a u r e n9-Jan-03 8:58
l a u r e n9-Jan-03 8:58 
GeneralRe: SSE Pin
peter27139-Jan-03 9:26
peter27139-Jan-03 9:26 
GeneralRe: SSE Pin
geo_m9-Jan-03 9:12
geo_m9-Jan-03 9:12 
QuestionRelease mode exception? Pin
clintsinger9-Jan-03 7:46
clintsinger9-Jan-03 7:46 
AnswerThe main thing is to create pdbs for release build Pin
AlexO9-Jan-03 8:03
AlexO9-Jan-03 8:03 
GeneralRe: The main thing is to create pdbs for release build Pin
clintsinger9-Jan-03 8:27
clintsinger9-Jan-03 8:27 
QuestionMultidimensional arrays - am I doing it correctly? Pin
Dominik Reichl9-Jan-03 7:46
Dominik Reichl9-Jan-03 7:46 
AnswerRe: Multidimensional arrays - am I doing it correctly? Pin
AlexO9-Jan-03 7:56
AlexO9-Jan-03 7:56 
GeneralRe: Multidimensional arrays - am I doing it correctly? Pin
Dominik Reichl9-Jan-03 8:50
Dominik Reichl9-Jan-03 8:50 
GeneralRe: Multidimensional arrays - am I doing it correctly? Pin
AlexO9-Jan-03 9:26
AlexO9-Jan-03 9:26 
AnswerRe: Multidimensional arrays - am I doing it correctly? Pin
Alvaro Mendez9-Jan-03 8:52
Alvaro Mendez9-Jan-03 8:52 
GeneralRe: Multidimensional arrays - am I doing it correctly? Pin
Dominik Reichl9-Jan-03 9:09
Dominik Reichl9-Jan-03 9:09 
GeneralRe: Multidimensional arrays - am I doing it correctly? Pin
Alvaro Mendez9-Jan-03 9:26
Alvaro Mendez9-Jan-03 9:26 
QuestionOUT OF MEMORY in RELEASE VERSION but OK in DEBUG ?? Pin
youssef9-Jan-03 7:42
youssef9-Jan-03 7:42 
AnswerRe: OUT OF MEMORY in RELEASE VERSION but OK in DEBUG ?? Pin
Chris Losinger9-Jan-03 8:02
professionalChris Losinger9-Jan-03 8:02 
GeneralRe: SetCurrentDirectory() not working?? Pin
Ted Ferenc9-Jan-03 6:48
Ted Ferenc9-Jan-03 6:48 
GeneralRe: SetCurrentDirectory() not working?? Pin
uandrej9-Jan-03 9:56
uandrej9-Jan-03 9:56 
GeneralRe: SetCurrentDirectory() not working?? Pin
Ted Ferenc9-Jan-03 21:31
Ted Ferenc9-Jan-03 21:31 
GeneralRe: SetCurrentDirectory() not working?? Pin
Anonymous9-Jan-03 23:49
Anonymous9-Jan-03 23:49 
GeneralSDK - MAPI .oft Files Pin
Harald Diel9-Jan-03 6:02
Harald Diel9-Jan-03 6:02 
GeneralRe: SDK - MAPI .oft Files Pin
Harald Diel12-Jan-03 22:50
Harald Diel12-Jan-03 22:50 
QuestionHow to create a menu item on the fly Pin
ns9-Jan-03 5:25
ns9-Jan-03 5:25 
AnswerRe: How to create a menu item on the fly Pin
Michael Dunn9-Jan-03 5:35
sitebuilderMichael Dunn9-Jan-03 5:35 
Generalsetting up a keyboard system wide hook (contains the code, if you would like to see it...) Pin
Joan M9-Jan-03 5:00
professionalJoan M9-Jan-03 5:00 
Hello,

INTRODUCTION:
1. I'm trying to install a system wide keyboard hook in order to avoid some keystrokes.
2. I've implemented that static callback f(x) inside a DLL.
3. I call the DLL exported function from a service.
4. I'm sure that the service works right. (it's a SERVICE_WIN32_OWN_PROCESS service).
5. It seems that the callback function that has the hook it's called only one time!.

PROTOTYPE:
static LRESULT CALLBACK HookTeclatLL(int nCode,WPARAM wParam,LPARAM lParam);


CALL
hHookTeclat = SetWindowsHookEx(WH_KEYBOARD_LL, HookTeclatLL, hInstDLLSCT, NULL);
return (hHookTeclat != NULL); <code>the return value is not NULL</code>


CODE:
static LRESULT CALLBACK HookTeclatLL(int nCode,WPARAM wParam,LPARAM lParam)
{
  if (nCode == HC_ACTION)
  {
    switch (wParam)
    {
      case WM_KEYDOWN:
      case WM_SYSKEYDOWN:
      case WM_KEYUP:
      case WM_SYSKEYUP:
      {
        LPKBDLLHOOKSTRUCT p = (LPKBDLLHOOKSTRUCT)lParam;
        bool bDeleteKey = false;

        bDeleteKey =  ((p->vkCode == VK_RWIN) ||
                      (p->vkCode == VK_LWIN) ||
                      (p->vkCode == VK_ESCAPE) ||
                      (p->vkCode == VK_F1) || 
                      (p->vkCode == VK_F2) || 
                      (p->vkCode == VK_F3) || 
                      (p->vkCode == VK_F4) || 
                      (p->vkCode == VK_F5) || 
                      (p->vkCode == VK_F6) || 
                      (p->vkCode == VK_F7) || 
                      (p->vkCode == VK_F8) || 
                      (p->vkCode == VK_F9) || 
                      (p->vkCode == VK_F10) || 
                      (p->vkCode == VK_F11) || 
                      (p->vkCode == VK_F12) || 
                      (p->vkCode == VK_CANCEL) ||
                      (p->vkCode == VK_RBUTTON) || 
                      (p->vkCode == VK_PAUSE) ||
                      (p->vkCode == VK_SNAPSHOT) ||
                      (p->vkCode == VK_APPS) ||
                      (p->vkCode == VK_SCROLL));

        if (!bDeleteKey)
        {
          if ((p->flags & LLKHF_ALTDOWN) != 0)
          {
            bDeleteKey = (p->vkCode == VK_TAB);
          }

          if ((p->flags & MOD_WIN) != 0)
          {
            bDeleteKey = true;
          }
        }

        if (bDeleteKey) 
        {
          logEstat("\nELIMINANT\n");  <code>In order to monitor only</code>
          MessageBox(NULL,"ELIMINANT","",MB_SERVICE_NOTIFICATION); <code>In order to monitor only</code>
          return 1; <code>this should remove the key pressed...</code>
        }

        break;
      }
    }
  }

  return CallNextHookEx(hHookTeclat, nCode, wParam, lParam);
}

Do you know anything that I'm missing or that I have misunderstood or something?

The problems are:
1. I think that only one time its called that static callback f(x).
2. the keys are not removed.
3. It seems that the messageboxes never appear... even with the MB_SERVICE_NOTIFICATION...

Thank you in advance.
GeneralRe: setting up a keyboard system wide hook (contains the code, if you would like to see it...) Pin
Joan M9-Jan-03 5:15
professionalJoan M9-Jan-03 5:15 

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.