remarknibor wrote:
> I'm trying to make sure I get the handle to the Notepad window before
> attempting alterations by using:
>
> hNotepad = FindWindow("Notepad",NULL);
>
> but it's returning NULL and I'm not sure why. Any ideas?
Because you are trying to locate the first window that has the class
name* "Notepad" and not the window name*. You should have Spy++ with
your VC++ install...Spy++ is your friend. (If you don't have Spy++,
download and use Winspector instead).
* Class names are different from window names. A class name is used to
create the ATOM object that is then used to create one or more windows
using that class.
FindWindow() is NOT a good method for locating a top-level window
handle. What happens if another instance of Notepad is opened and the
function picks that handle instead?
A better approach is to use EnumWindows() with GetWindowThreadProcessId().
--
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197
*NEW* MyTaskFocus 1.1
Get on task. Stay on task.
http://www.CubicleSoft.com/MyTaskFocus/