Skip to content

Demonstrates how the focus can be given to another process

Notifications You must be signed in to change notification settings

epsitec/window-focus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

window-focus

This C# solution demonstrates how the focus can be given to another process.

  • Process Alice starts process Bob and passes Bob its window handle.
  • Bob sets its owner to Alice's window handle.
  • Alice can now call SetActiveWindow() using Bob's window handle to activate Bob. Bob gets the keyboard focus too.

For this to work also when minimizing Bob, there is some additional logic:

  • When Bob gets minimized, it resets its owner to null.
  • When Bob gets restored, it restores its owner to Alice's window handle.
  • Alice can restore Bob by using ShowWindow() with SW_RESTORE.

About

Demonstrates how the focus can be given to another process

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages