Full screen mode for C++/CX application on startup

James Pedersen 5 Reputation points
2023-11-29T18:43:22.4866667+00:00

Hi,

I'm working on a Windows UWP (Universal Windows Platform) C++/CX Application. I would like for this application to be full-screen from the moment that it launches, rather than briefly not full-screen and then changed to full-screen later. Does anyone know of a way to achieve this?

Thank you,

James Pedersen

Developer technologies | Universal Windows Platform (UWP)
Developer technologies | C++
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. James Pedersen 5 Reputation points
    2023-11-29T20:11:47+00:00

    I found a solution for this issue. I start my App::OnLaunched() function as follows:

    void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e)
    {
        ApplicationView^ view = ApplicationView::GetForCurrentView();
    
        Windows::Foundation::Rect r;
        Windows::Foundation::Size sz;
        //view->SetPreferredMinSize(r)
        bool b = view->TryEnterFullScreenMode();
        int c = 0;
        while (b == false) {
            b = view->TryEnterFullScreenMode();
            c++;
            if (c == 100) {
                exit(1);
            }
        }
        r = view->VisibleBounds;
        sz = Windows::Foundation::Size(r.Width, r.Height);
        view->SetPreferredMinSize(sz);
        .....
    

    The code continually tries to set the window as full-screen, and exits if it cannot achieve this. Then once the window is full-screen, the code sets the preferred minimum window size to the dimensions of the full-screen.

    But that's not sufficient, because the application (or more precisely, the splash screen) starts in not-full-screen mode and then shifts to full-screen mode later.

    So the last thing is to adjust the application's splash-screen in Package.appxmanifest. I created a large 2480x1200 monochrome image using the photo editor GIMP, and then used this as my splash-screen image in Package.appxmanifest. I then ensure that only the "Scale400" (the 2480x1200 scaled version) of this PNG is the only "SplashScreen..." image present in my Assets\ directory.

    And with all of these changes, the application (splash-screen included) is full-screen from the moment it is launched.

    1 person found this answer helpful.
    0 comments No comments

  2. James Pedersen 5 Reputation points
    2023-11-29T20:11:04.8633333+00:00

    To the team at Microsoft, please feel free to consider this question resolved.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.