How would I make my program check if a certain application like "notepad" has focus and ultimately open my second form when it does have focus, closing that second form when it loses focus.
(I would Also like to include an updater so that if the checkbox is checked while "notepad" is closed keep the checkbox checked, but do not open my second form until "notepad" has been opened) I know this is a very specific question and hence why I couldn't find anything relative to this.
Here is a mockup of what I believe it would look like:
DLL import
getforeground window
Process g = "notepad"
if (g is Foreground window in front && checkbox.checked) // my checkbox i use to enable the program
{
show form two
}
else
{
hide form two
}