Finding out if foreground window is running fullscreen

csharp Norway
  • 14 years ago


    I'm working on a application that will deliver messages to me while i'm using fullscreen applications, mostly games. It will show a small overlay window with whatever info it should show. (If you ever testet the gaming program Xfire, wich is has a chat feature that does something like this but only for its own chat.)
    I've tried to find something to read, and found out that p/invoke calls are the way to go.
    but i just cant figure out how i can find out if the foreground window is running in fullscreen.

    private static extern IntPtr GetForegroundWindow();

    GetForegroundWindow(); gives me an int pointer wich i can loop trough Process.GetProcesses() and find wich process the foreground window belongs to. But there is little information to help me in a Process object.

    I could just match the proccess name against a list of known fullscreen aplications, but i dont want to do that, think it's a too cheap solution, i want it to work without having to register every application you want it to work with.

    So if anyone have an idea of where i should look or some tip i would be thankful.

  • 14 years ago

    Well, i found something that looked usefull when i searched msdn and some more, so the first problem is solved.

    private static extern bool IsZoomed(IntPtr hWnd);

    this method will find out if  window of intptr is maximized, and i hope a fullscreen is registred as maximized when running.
    in this case wich i should find with GetForegroundWindow();

    no more.

Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The most exciting phrase to hear in science, the one that heralds new discoveries, is not 'Eureka!' but 'That's funny...'” - Isaac Asimov