CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 11 of 11

Threaded View

  1. #7
    Join Date
    Jan 2013
    Posts
    4

    Re: how to detect if window media player is running in full screen mode

    Hi igor,

    The application I am working on is a MFC standalone application. Not using a IWMPlayer object etc. I need to take some action based on the applications running in fullscreen on Windows. For example if mspaint is opened in fullscreen or any other application is opened in fullscreen. Below is the code snippet

    testFullScreenApp()
    {
    HWND hForeGndWnd = ::GetForegroundWindow();
    if (hForeGndWnd == NULL)
    {
    return FALSE;
    }

    RECT deskRect = {0};
    HWND hDesktopWnd = ::GetDesktopWindow();
    if (hDesktopWnd)
    {
    ::GetClientRect(hDesktopWnd, &deskRect);
    }

    WINDOWINFO wi = {0};
    ::GetWindowInfo(hForeGndWnd, &wi);

    if ((wi.rcClient.left == wi.rcWindow.left && wi.rcWindow.left == deskRect.left) &&
    (wi.rcClient.top == wi.rcWindow.top && wi.rcWindow.top== deskRect.top) &&
    ((wi.rcWindow.right-wi.rcClient.right <= 2) && wi.rcWindow.right == deskRect.right) &&
    ((wi.rcWindow.bottom-wi.rcClient.bottom <= 2) && wi.rcWindow.bottom == deskRect.bottom))
    {

    return TRUE;
    }
    }

    This logic works fine for all applications except windows media player. If windows media player on desktop is running in fullscreen then this logic fails whenever there is display controls (play, pause etc) is in picture and works if they are not.

    Please do the needful.
    Last edited by nitii; January 24th, 2013 at 01:25 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured