Skip to main content
GameDev.net gamedev.net
🔒 Locked

[.net] Getting active form

Started by doctorsixstring Oct 9, 2005 at 10:15 AM 3 replies 2.7k views
Original Post
doctorsixstring
doctorsixstring
How can I determine if my app's form is currently active/in the foreground/has focus?
JakobM
JakobM
Maybe you can use "System.Windows.Forms.Form.ActiveForm".

It will give you the currently active form. From there you can see if it's the form you're looking for.
doctorsixstring
doctorsixstring
I looked at System.Windows.Forms.Form.ActiveForm, but it seems to be the current active form in my application, not on the entire desktop.
afsajghfd
afsajghfd
I was working around this because the OtherApplicationHasPriorityException =/
and well, i found that it can be useful do

if System.Windows.Forms.Form.ActiveForm is this/Me [then] C#/VB

inside the form to know if the form it's active in the foreground.

I revive this hopping help someone else with the same problem

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.