I am trying to Hook Cocoa API.
I know cocoa provides a public api for hooking, so it’s possible to hook the system function and retrieve information like the curren
You can't intercept another application's drawing as it happens, but you can capture the results after the fact. Use Quartz Window Services to take screenshots, and Quartz Display Services to find out when the screen gets updated.
The words you choose and the very broad scope they cover suggest you need to start at the very beginning. There is a simple Cocoa Application tutorial here. It walks you through the basic process of creating a Cocoa application for the Mac. Start there, then post more specific questions as they arise.
The term you are looking for is something like "systemwide code injection," and Cocoa does not provide an API for any such thing. You'd need to take a look at something like mach_star or SIMBL. But honestly, this is one of those things where, if you have to ask, it's probably a little advanced for you. Modifying other processes' code is a gigantic PITA and even harder to do right, even with as much help as mach_star offers. If you want to see just how hard, take a look at Unsanity's site. That's the company that pioneered code injection on OS X, and their entire product line is based around it — and many of their programs are still not compatible with OS X 10.6.
Including...
#import <objc/objc.h>
#import <objc/runtime.h>
will allow you to have access to modifying the classes and objects at runtime. Although this is rather 'reckless.'
A much better Idea is to use Objective-C Categories for a more 'safe' access.