By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,405 Members | 1,054 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,405 IT Pros & Developers. It's quick & easy.

Getting text from RichTextbox using a Hook

P: n/a
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 SetWindowsHookEx msg:
// setting the hook on the richedit20a window
// _hookType = EM_SETTEXTEX, when converted to uint is 1119
_hHook = SetWindowsHookEx(_hookType,_filterFunc,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
SetWindowsHookEx for the hook type of WH_CBT on my
AppDomain.GetCurrentThreadID() and I can see an instance of the hook
being returned.

Nov 17 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
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.

Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.