只能通过全局hook来做。http://dev.csdn.net/develop/article/42/42588.shtm
http://dev.csdn.net/develop/article/53/53147.shtm
这两篇文章不错,你自己看完后就应该知道怎么写了。既然对API不熟悉就先看:
http://dev.csdn.net/develop/article/52/52486.shtm

解决方案 »

  1.   

    这个是获得记事本内容的API
    拿去参考一下,如果用hook ,你都能截获啦,有点太麻烦 !using System.Reflection;[DllImport("user32.dll", EntryPoint="FindWindow")]
    public static extern int FindWindow (
    string lpClassName,
    string lpWindowName
    );[DllImport("user32.dll", EntryPoint="FindWindowEx")]
    public static extern int FindWindowEx (
    int hWnd1,
    int hWnd2,
    string lpsz1,
    string lpsz2
    );[DllImport("user32.dll", EntryPoint="SendMessage")]
    public static extern int SendMessage (
    int hwnd,
    int wMsg,
    int wParam,
    System.Text.StringBuilder lParam
    );private void button1_Click(object sender, System.EventArgs e)
    {
    int hwnd = FindWindow("notepad", null);
    hwnd = FindWindowEx(hwnd, 0, "Edit", null);
    System.Text.StringBuilder str = new System.Text.StringBuilder(255);
    SendMessage(hwnd, 0xD, str.Capacity, str);
    MessageBox.Show(str.ToString());
    }
      

  2.   

    先找到那个控件的handle,然后通过SendMessage的GETTEXT来得到控件的内容!