Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6110453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:31:02+00:00 2026-05-23T14:31:02+00:00

In my C++ Win32 program I want to set the current Display Settings to

  • 0

In my C++ Win32 program I want to set the current Display Settings to “Extend” mode. I Googled and found out that SetDisplayConfig() is the way to go forward in Windows 7 (I’m on Windows 7) but now I am kind of stuck how to proceed as the MSDN explanation (link here) is pretty confusing. I am very much new to C++ and API programming so I am finding it difficult to understand this.

I would highly appreciate some code sample and an explanation. Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T14:31:03+00:00Added an answer on May 23, 2026 at 2:31 pm

    Okay so I figured out the answer.

    To identify the current configuration:

    UINT32 PathArraySize = 0;
    UINT32 ModeArraySize = 0;
    DISPLAYCONFIG_PATH_INFO* PathArray;
    DISPLAYCONFIG_MODE_INFO* ModeArray;
    DISPLAYCONFIG_TOPOLOGY_ID CurrentTopology;
    
    GetDisplayConfigBufferSizes(QDC_ALL_PATHS, &PathArraySize, &ModeArraySize);
    
    PathArray =   (DISPLAYCONFIG_PATH_INFO*)malloc(PathArraySize * sizeof(DISPLAYCONFIG_PATH_INFO));
    memset(PathArray, 0, PathArraySize * sizeof(DISPLAYCONFIG_PATH_INFO));
    
    ModeArray =   (DISPLAYCONFIG_MODE_INFO*)malloc(ModeArraySize * sizeof(DISPLAYCONFIG_MODE_INFO));
    memset(ModeArray, 0, ModeArraySize * sizeof(DISPLAYCONFIG_MODE_INFO));
    
    LONG ret = QueryDisplayConfig(QDC_DATABASE_CURRENT,&PathArraySize, PathArray, &ModeArraySize, ModeArray, &CurrentTopology);
    // Above CurrentTopology variable will aquire the current display setting (ie Extend, Duplicate etc)
    
    free(PathArray);
    free(ModeArray);
    

    To set the required display setting (Extend, Duplicate etc):

    SetDisplayConfig(0,NULL,0,NULL,SDC_TOPOLOGY_EXTEND|SDC_APPLY);
    

    or

    SetDisplayConfig(0,NULL,0,NULL,SDC_TOPOLOGY_CLONE|SDC_APPLY);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Win32 C++ program that validates user input and updates the UI
In order to try out how to program with the Win32 API, I wrote
I have written a set of Win32 dlls that encapsulate a Delphi Frame (see
I'm creating a Win32 program that will be executed every time the computer turns
I have a win32 program. I want to change status text when mouse come
The following C++ Win32 console program assigns an array to a pointer to void,
When I compile and run a simple Win32 GUI program in MinGW+MSys with command
I have a program that still must target Windows XP (_WIN32_WINNT 0x501), as most
On Win32, how can a C++ program determine how many threads are active in
I have an existing C++ win32 console app. This application contains a main program

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.