Handling global event

Discussion in 'Mac Programming' started by shtuceron, Mar 17, 2010.

  1. shtuceron macrumors newbie

    Dec 22, 2009
    I am sorry for stupid question, but how use addGlobalMonitorForEventsMatchingMask method?? Can you get me some project where using this method.
  2. kainjow Moderator emeritus


    Jun 15, 2000
  3. shtuceron thread starter macrumors newbie

    Dec 22, 2009
    yes i looked. May be i dont understand right,
    addLocalMonitorForEventsMatchingMask:handler: - method which get event (example key press) into our program, addGlobalMonitorForEventsMatchingMask:handler: - method which get event from other application and 'pass' it into our program (even our application is not active)??

    addLocalMonitorForEventsMatchingMask - work, addGlobalMonitorForEventsMatchingMask - not working, therefore i asked you send me project where this method work.
  4. gnasher729 macrumors P6


    Nov 25, 2005
    What do you mean by "doesn't work"? Remember that for example a key event would only be sent to the active application, so it would be recognised by a _local_ monitor in the active application, and by a _global_ monitor in any other (inactive) application.
  5. shtuceron thread starter macrumors newbie

    Dec 22, 2009
    OK, _local_ monitor and _global_ monitor this is abstract name or no, never i doesn't work with event, and don't understand you fully
  6. Alkiera macrumors regular

    Mar 11, 2008
    I think he means you will never see the same event in both monitors. If your application is currently in focus, clicks/keys will register on the local monitor. If it is not the focused application, they will register with the global monitor.
  7. shtuceron thread starter macrumors newbie

    Dec 22, 2009
    This discussion is very useful for me, but the problem is not solution addLocalMonitorForEventsMatchingMask is work, the applicaton is active, addGlobalMonitorForEventsMatchingMask not working, may be you get me some example code, project where using addGlobalMonitorForEventsMatchingMask.

Share This Page