SetWindowsHookEx in Win 9x/ME/NT4

This is a discussion on SetWindowsHookEx in Win 9x/ME/NT4 within the Windows Programming forums, part of the Platform Specific Boards category; Hello... I'm trying use SetWindowsHookEx() in windows 9x/ME/NT4. Somebody know? Obrigado......

  1. #1
    A.I Programmer
    Join Date
    Mar 2007
    Location
    Teresina - Brazil
    Posts
    47

    SetWindowsHookEx in Win 9x/ME/NT4

    Hello...

    I'm trying use SetWindowsHookEx() in windows 9x/ME/NT4.

    Somebody know?

    Obrigado...

  2. #2
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,452
    Use it for what?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    A.I Programmer
    Join Date
    Mar 2007
    Location
    Teresina - Brazil
    Posts
    47
    I use with KeyboardProc (WH_KEYBOARD) and MessageProc (WH_MSGFILTER).

    ...

  4. #4
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,452
    And your question is that you don't know how to do what you want to do with the function?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #5
    A.I Programmer
    Join Date
    Mar 2007
    Location
    Teresina - Brazil
    Posts
    47
    I want make this...

  6. #6
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,246
    What are you having problems with? You need to narrow your question down.

  7. #7
    A.I Programmer
    Join Date
    Mar 2007
    Location
    Teresina - Brazil
    Posts
    47
    I'm making thus:

    Code:
    /* Global Variables */
    
    HHOOK hMsgFilter;
    HWND ToolBar;
    
    /* ... */
    
    LRESULT CALLBACK MessageProc(int Code, WPARAM wParam, LPARAM lParam)
    {
       RECT rc;
       MSG *msg;
       long x, y;
       
       if(Code < 0)
       {
          return CallNextHookEx(hMsgFilter, Code, wParam, lParam);
       }
       
       msg = (MSG*)lParam;
       
       if(Code == MSGF_MENU)
       {
          GetWindowRect(ToolBar,&rc);
          
          if(msg->message == WM_MOUSEMOVE)
          {
             x = LOWORD(msg->lParam); y = HIWORD(msg->lParam);
             x -= rc.left; y -= rc.top;
                
             SendMessage(ToolBar,WM_MOUSEMOVE,msg->wParam,MAKELPARAM(x,y));
          }
       }
       
       return CallNextHookEx(hMsgFilter,Code,wParam,lParam);
    }
    
    /* ... */
    
    LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
    {
       hMsgFilter = SetWindowsHookEx(WH_MSGFILTER,(HOOKPROC)MessageProc,GetModuleHandle(NULL),0);
       
       switch (msg)
       {
          case WM_DESTROY:
          {
             UnhookWindowsHookEx(hMsgFilter);
             PostQuitMessage(0);
          }break;
          
          default:
            return DefWindowProc(hwnd, msg, wParam, lParam);
       }
    
       return 0;
    }
    In this way not function for windows 9x/ME/NT4.

    Obrigado...

  8. #8
    A.I Programmer
    Join Date
    Mar 2007
    Location
    Teresina - Brazil
    Posts
    47
    I just want know, why this fails in Win9x/ME/NT4...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 8
    Last Post: 05-07-2009, 11:31 AM
  2. can't see console win activation using setwindowshookex
    By otimist in forum Windows Programming
    Replies: 0
    Last Post: 12-16-2005, 10:54 AM
  3. help with this
    By tyrantil in forum C Programming
    Replies: 18
    Last Post: 01-30-2005, 03:53 PM
  4. removing WIN 2000
    By DMaxJ in forum Tech Board
    Replies: 3
    Last Post: 10-15-2002, 09:25 AM
  5. Can I get this to loop back?
    By Unregistered in forum C Programming
    Replies: 9
    Last Post: 05-07-2002, 03:34 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21