0

I am using .NET Core 3.1 Console Application C#

How do i check current DISPLAY resolution of windows? (Not a monitor maximum resolution).

I want to make my app with full screen having 1024x768 resolution default.

I don't want to use nircmd and Qres apps for this.

Also I'm not want to get resolution of monitor highest available.

Or

How to set 1024x768 screen resolution using C# console Application?

using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace ConsoleApp4
{
    class Program
    {
        static void Main(string[] args)
        {

            Console.WriteLine("Hello World!");
            Console.Read();
        }
    }
}


Rand Random
  • 7,300
  • 10
  • 40
  • 88
  • Your question is all about _getting_ the current screen resolution, but then your bolded text is about _setting_ it. Are you trying to do both? – Kirk Woll Mar 18 '22 at 18:04
  • use the API via PInvoke http://pinvoke.net/default.aspx/user32/ChangeDisplaySettingsEx.html – Ralf Mar 18 '22 at 18:04
  • Are you looking for https://stackoverflow.com/questions/22053112/maximizing-console-window-c-sharp ? – Rand Random Mar 18 '22 at 18:09
  • fyi - c# 3 and .net core 3 aren't the same - no idea why you tagged your question with c# language versions – Rand Random Mar 18 '22 at 18:11
  • @Kirk Woll : Thank you man for response. 1st thing i did't found any code for setting resolution to 1024x768. 2nd thats why im using Nircmd to change resolution. For some reason im using it for every 1 seconds to set resolution to 1024x768. Here i dont want to launch that process for every 1 seconds if resolution already set to 1024x768. I dont to how to check resolution is set to 1024x768 or not. Or for avoiding this i want to set resolution using my console app. But i didnt found any code. Simply i want to set 1024x768 resolution with fullscreen. i already having fullscreen code. – haseakash2009 Mar 18 '22 at 18:18
  • @Rand Random: No man. i want to set reso 1024x768 by using Console application. Im using .net core 3.1 console app and using nuget manager. – haseakash2009 Mar 18 '22 at 18:20
  • @Ralf : Can u please tell me how to add all? Im still getting errors – haseakash2009 Mar 18 '22 at 18:31
  • Add your code you use to the questions and the error you get. Besides that there is nothing i can help with currently. The link i gave contains a complete example. – Ralf Mar 18 '22 at 19:14
  • @Ralf : Here is sample code updated. For god says tell me full solution. I only want primary screen resolution change to 1024x768. here is another example. but i still dont know how to do it. https://stackoverflow.com/questions/195267/use-windows-api-from-c-sharp-to-set-primary-monitor – haseakash2009 Mar 18 '22 at 19:24
  • Can you update the question with what you have tried so far? And what specific issue you are running into? This question is too vague and the code snipped is a Hello, Word app. – beautifulcoder Mar 18 '22 at 22:44
  • @beautifulcoder : i wish to make console app full screen no borders. (i have this code). That works fine. 2nd part i wish to set screen resolution to 1024x768 using my console application. This code i still diden't get. Just want to set 1024x768 resolution of windows display/monitor using console application. Where display drivers are installed or not. It a simple question. – haseakash2009 Mar 19 '22 at 10:46

0 Answers0