Variable Type For The "buffer" Required In LParam Of The WM_GETTEXT SendMessage?Dec 26, 2010
I'm trying to teach myself to use SendMessage to manipulate other windows and have been reading as much as possible on the net to understand how to do this. I've come upon a problem though that I have been unable to find an answer for on the net. Currently I'm attempting to read text from another window. I am under the impression that I use FindWindowEx to dig into a target window's handle and find the controls in the form, although I still haven't been able to do it successfully. I read somewhere that I use Spy++ to find the names of the classes I am searching for with FindWindowEx, and that once I have the handle of the specific control containing the text I use SendMessage to send it a WM_GETTEXT message. The problem I'm having is that for the lParam MSDN says that SendMessage needs a "Buffer", and I'm not sure how to use one of those. I tried using the type Buffer, but that didn't seem to work. Is buffer a euphamism for a certain variable type? I tried using IntPtr as well but the returned IntPtr was always IntPtr.Zero...
So basically my questions are:
1. How exactly can I use FindWindowEx to locate a control's handle? I'm having trouble getting it to work, but I'm probably just not understanding how it functions.
2. What is the variable type for the "buffer" required in lParam of the WM_GETTEXT SendMessage?