Get window that has the focus

  • Thread starter Thread starter Ralf Heinzelbach
  • Start date Start date
R

Ralf Heinzelbach

Hello!
Does anybody have an idea how to get the foreground window hwnd...
namley the one that the cursor blinks in?
I always tried to get it (under XP) by excluding certrain windows...
like the ones that are "iconic", invisible, etc.
But now that Vista has introduced some new foreground windows like
the... I don't remember its name, but I think it was the floating bar...
I never know which windows I have to exclude from my "foreground"
windows, that's why I think that I make a big mistake iterating through
all windows and excluding the ones I know that don't fit my criterias.
Thank you very much if you have any ideas!
Ralf Heinzelbach
 
Hello!
Does anybody have an idea how to get the foreground window hwnd...
namley the one that the cursor blinks in?
I always tried to get it (under XP) by excluding certrain windows...
like the ones that are "iconic", invisible, etc.
But now that Vista has introduced some new foreground windows like
the... I don't remember its name, but I think it was the floating bar...
I never know which windows I have to exclude from my "foreground"
windows, that's why I think that I make a big mistake iterating through
all windows and excluding the ones I know that don't fit my criterias.
Thank you very much if you have any ideas!
Ralf Heinzelbach

Do you mean something like the GetForegroundWindow api?

http://msdn.microsoft.com/en-us/library/ms633505(VS.85).aspx

Declare Function GetForegroundWindow Lib "user32" () As System.IntPtr

HTH
 
Yes, I mean something like that. But it doesn't meet my conditions...
I am selling an on screen keyboard which sets itself as the top window,
thus GetForeGroundWindow always returns my application's windows as the
foreground window.
I then thought I would have to iterate through each window that is shown
on the desktop, but it also returns the windows that no user can type
something into, like the Vista (sorry, I don't know the extact
translation) "feedback bar"...
I am in a dead end street.
Can you help again?
Ralf Heinzelbach
 
PS: One of these windows is called "App bar bullet" under Vista (I think
that's a universal name), but I don't know how to determine if that is a
window that the user can type into...
 
Back
Top