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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Keeping a form on top with focus

Status
Not open for further replies.

Blobtech

Programmer
Dec 19, 2002
28
GB
Hi,

I have a project where I have set up a PC as a time clock, so our employees can clock in and out. It's a WIN98 PC so I've changed the Shell in the [Boot] section to run my program rather than Explorer when the PC boots up.

The swipe card reader I have connects to the keyboard port so the swipe card program needs to have focus for the data to be put into an textbox.

To stop our employees 'playing', I have diconnected the keyboard. If there are any problems, I am using PC Anywhere to connect to the PC. Unfortunately when I disconnect PC anywhere, my clocking program loses the focus. What I would like to know is, is it possible to always force a form to have focus? The frmMain_LostFocus event does not seem to fire.

Lee
 
Thanks for the info Paul, unfortunately keeping the form on top does not stop the form losing the focus.
 
In the forms Form_Deactivate event, add me,setfocus. The Form_Deactivate event occurs when an object is no longer the active window, so it should keep your app in focus.

Pete Vickerstaff - Hedra Software
 
Thanks Paul, SetForeGroundWindow does the trick.

Pete, for some reason, the deactivate event is not firing.

Lee Greenwood
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top