External Program ListBox read

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? I tried to use the "FindWindow" function, but it returns an integer but I need HandleRef.

2. Did anyone write something like that before and could be so kind to paste his code for reference?
[699 byte] By [sagym] at [2007-11-20 11:09:15]
# 1 Re: External Program ListBox read
Well, have a look here :
http://pinvoke.net/default.aspx/user32.FindWindow

The scary part is you'd need to use the FindWindowEx API as well to find a window within a window, in this case the Listbox. Do you know the name of the ListBox
HanneSThEGreaT at 2007-11-9 11:36:26 >