How can i get text from CRichEditCtrl
-
it's a chatting tool and i use spy++ get the RichEdit20A handle from the dialog but i can't use the handle to get the text maybe it shields WM_GETTEXT msg how can i get the text in another way??
Accessing data of another process isn't that simple...that's one of the main points of protected mode. What do you want to do that involves using spy++ and getting text from a control in another process?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
-
Accessing data of another process isn't that simple...that's one of the main points of protected mode. What do you want to do that involves using spy++ and getting text from a control in another process?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
-
i want to carry out the auto reply function so i have to get the chatting text from the dialog and then analyse it and reply automatically it's hard i know do more and you will learn more ;P thanks for reply
Most IM programs support plugins, maybe it would be easier to write one if the one you want to target there does so? Anyhows, docs say that WM_GETTEXT works over process boundaries for some controls, and for some it doesn't, so i guess for rich edit it doesn't work. You could try a trick but it's not too safe and reliable. You could allocate shared memory, lock it, post WM_GETTEXT to the control passing the address of the shared memory block, wait a while (sadly you can't really know if the rich edit control has processed that message yet or not) and then you should have the text in the memory block. However, this can lead to crashes and asynch problems. You could try for example filling the buffer with 1s, and then after you sent the message keep checking for a 0 character, assuming that you have allocated a big enough buffer, when the 0 is there then the rich edit has probably finished copying its text into the buffer (since 0 should be the last character of the text and we assume it is copying the text from its start to its end). Combining that with maybe some timeouting... Or on a different aproach, you could inject a DLL into the process that hooks itself to the rich edit control and could for example when the control gets WM_SETTEXT copy the text into some shared buffer and notify your process of the change. This all is just ideas, don't know if any of it could ever work.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
-
Most IM programs support plugins, maybe it would be easier to write one if the one you want to target there does so? Anyhows, docs say that WM_GETTEXT works over process boundaries for some controls, and for some it doesn't, so i guess for rich edit it doesn't work. You could try a trick but it's not too safe and reliable. You could allocate shared memory, lock it, post WM_GETTEXT to the control passing the address of the shared memory block, wait a while (sadly you can't really know if the rich edit control has processed that message yet or not) and then you should have the text in the memory block. However, this can lead to crashes and asynch problems. You could try for example filling the buffer with 1s, and then after you sent the message keep checking for a 0 character, assuming that you have allocated a big enough buffer, when the 0 is there then the rich edit has probably finished copying its text into the buffer (since 0 should be the last character of the text and we assume it is copying the text from its start to its end). Combining that with maybe some timeouting... Or on a different aproach, you could inject a DLL into the process that hooks itself to the rich edit control and could for example when the control gets WM_SETTEXT copy the text into some shared buffer and notify your process of the change. This all is just ideas, don't know if any of it could ever work.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <