Getting text from RichTextbox using a Hook

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • murlbrown@gmail.com

    Getting text from RichTextbox using a Hook

    Basicly im trying to determine when a new line has been appended to the
    textbox of another application. Using spy++ I see that the msg (wm_user
    + 97) is being sent, which is the EM_SETTEXTEX msg(combination of
    wm_settext and em_replacesel).
    Below are a few lines of code of what im trying to accomplish:

    private const uint WM_USER = 0x0400;
    EM_SETTEXTEX = (WM_USER + 97) // Comes from an enum I have. (hooktype)

    I have gotten the ThreadID of the RichTextbox in the other app I want
    to catch appended text on, and then am calling a SetWindowsHookE x msg:
    // setting the hook on the richedit20a window
    // _hookType = EM_SETTEXTEX, when converted to uint is 1119
    _hHook = SetWindowsHookE x(_hookType,_fi lterFunc,IntPtr .Zero,threadID) ;

    When doing this though I am getting no instance of an IntPtr back
    letting me know the hook is successfull. I can only conclude that the
    hookType uint code is not right or its not injecting correctly into the
    thread. I have tested that the rest of my code is correct by doing a
    SetWindowsHookE x for the hook type of WH_CBT on my
    AppDomain.GetCu rrentThreadID() and I can see an instance of the hook
    being returned.

  • murl

    #2
    Re: Getting text from RichTextbox using a Hook

    Well I figured out that I had to include the instance of my hook dll to
    inject with, in order to hook anything outside of my own running
    process, but still can not get a return type back on the EM_SETTEXTEX
    hook type when trying to hook.

    I can get a return back on any other types of hooks, well along with
    the program im trying to hook crashing heh. Any additional help on the
    EM_SETTEXTEX msg would be great.

    Comment

    Working...