Getting External Focus

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to get (or set) the focus on an external window but to no avail. I've imported the "GetActiveWindow" and "GetFocus" from the user32.dll but those 2 functions seem to only work for windows my application owns... I can get the hWnd of the process I want to check/set focus on. Any help would be greatly appresated.

Just to be a little more clear, say NotePad is up; I'm trying to make my program set focus to the opened Notepad Process (though its hWnd if possible?), or check when the opened NotePad process gets focus. Thanks
 
To get the focus of another application use

int hwnd = FindWindow(null,"App titile");

//use this handle to set the focus or bring window to top.

Shak.


I'm trying to get (or set) the focus on an external window but to no
avail. I've imported the "GetActiveWindow" and "GetFocus" from the
user32.dll but those 2 functions seem to only work for windows my
application owns... I can get the hWnd of the process I want to check/set
focus on. Any help would be greatly appresated.
Just to be a little more clear, say NotePad is up; I'm trying to make my
program set focus to the opened Notepad Process (though its hWnd if
possible?), or check when the opened NotePad process gets focus. Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top