Hello all,
I'm trying to write a program which will be able to read a list box in an external program using WinAPI.
I'm using sendMessage function:
public
static extern IntPtr SendMessage(HandleRef hWnd, uint Msg, IntPtr wParam, IntPtr lParam);and want to send the LB_GETTEXT message to the window of the exernal program.
A few questions:
1. How can I get the handler for the external window needed for the "hWnd" variable?
2. Did anyone write something like that before and could be so kind to paste his code for reference?
AlanPosted Oct 3, 2007, 12:32 PM
You can use the API function, FindWindow(), to get the handle to the external program's window.
The P/Invoke signature and an example of usage for this function are shown here:
http://pinvoke.net/default.aspx/user32/FindWindow.html
I'd also check out the SendMessage() function on the same site for some tips on using that.