Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Always on Top / Keyboard input

Status
Not open for further replies.

bbuk

Technical User
Apr 27, 2002
44
GB
Hi
I am creating an application which lives in the system tray, but when the icon is clicked the main window is opened on top of any others. I use the SetWindowPos api call to achieve this.

My problem is that I cannot get the window to have the focus when it opens. Keyboard input always goes to the task-bar. If I click on the window then it receives kbd input.

Any help or suggestions gratefully received!
 
Hi,

Have you tried SetActiveWindow or SetForegroundWindow?

I believe it's now Windows convention that no app can 'grab' the focus for itself, so you might not have any success. Clicking the window in order to type into it is a user choice, voluntary.

- Andy.
 
Thanks for your input. I have tried what you suggest, also a setfocus call (although I kept receiving an error with this and never got it to work). I think you are right that conventionally the window title bar and task bar button will flash to attract the users attention and thats it. I was hoping to find a way around this - maybe its not possible?
 
I wanted to do a similar thing to notify users when they got new emails, and I couldn't figure out how to do it from an app that's already running in the System Tray.

However, I believe that if you shell the application then it will have the focus, maybe you could botch it up that way?

- Andy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top