Code Monkey home page Code Monkey logo

windowsdisplayapi's Introduction

WindowsDisplayAPI

WindowsDisplayAPI is a .Net wrapper for Windows Display and Windows CCD APIs

How to get

To download the latest version of this library, take a look at the library's NuGet page.

Help me fund my own Death Star

--OR--

You can always donate your time by contributing to the project or by introducing it to others.

Related Projects

  • NvAPIWrapper: NvAPIWrapper is a .Net wrapper for NVIDIA public API, capable of managing all aspects of a display setup using NVIDIA GPUs

  • EDIDParser: EDIDParser is a library allowing all .Net developers to parse and to extract information from raw EDID binary data. (Extended Display Identification Data)

  • HeliosDisplayManagement: An open source display profile management program for Windows with support for NVIDIA Surround

License

Copyright (C) 2017-2020 Soroush Falahati

This project is licensed under the GNU Lesser General Public License ("LGPL") and therefore can be used in closed source or commercial projects. However, any commit or change to the main code must be public and there should be a read me file along with the DLL clarifying the license and its terms as part of your project as well as a hyperlink to this repository. Read more about LGPL.

windowsdisplayapi's People

Contributors

1knueller avatar falahati avatar flux88 avatar hoffs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

windowsdisplayapi's Issues

Library does not allow for serialization to file

Hi,

This library has issues dumping all of the data to an XML file because it can't be serialized due to many of the classes not having parameterless constructors.

I've fixed this and will do a pull request shortly.

Thanks for a great library!

Some fields show "Identity" instead of real value

First of all, awesome API, thank you so much ❤️.

Apologies if I'm missing something obvious here but (in some places) I'm seeing Identity as return value where I was expecting a value. For example like below, taken from the WindowsDisplaySample demo program. Using version 1.3.0.13.

All pointers appreciated.

image

Enabling displays does not work

Hello,

I tried to use the new version of Your library and it seems that enabling displays stopped working.
The sample throws an exception for "DeviceContext: Enable All" in

var validSetting = display.DisplayScreen.GetPreferredSetting();

because display.DisplayScreen is null. I tried to enable displays in my code via API call but it did not work either.

Inlcude the "DeviceFriendlyName"

My Setup is the following:

  • Dell Precision 7510
  • 2x FUJITSU E24-9 TOUCH

When using your library, I do not get "E24-9 TOUCH" as DisplayName. On stackoverflowis a solution to get this information:

Maybe it would be possible to retreive this information and also a display name from the internal laptop screen?

Imgur

Windows 11 compatibility

Hi!

It seems like wrapper have some troubles with detecting displays on Win11.

Display.GetDisplays() returned empty collection.

Could you clarify, it is compatibility issue or it's on my side?

Display Disable & Enable 'ScreenName' issue

Hi

I'm working on a little project that will allow me to store display settings for all 4 of my monitors and then let me restore those settings at a later time.

However, I've run into issues with Display.Enable which calls 'displaySetting.Save' which in turn uses the 'ScreenName' property. From what I can see this won't really work, and is not for me currently, as the 'ScreenName' property won't be consistent when switching a display between on and off. I'm not 100% sure if this is a bug or if I'm just doing it wrong. I've actually had a bit of a hard time getting this far and so it's possible I'm just doing something wrong.

For example, let's say I have 2 displays and both are currently ON.
If I call 'WindowsDisplayAPI.Display.GetDisplays()' I will have a list of 2 and the 'ScreenName' for each will be as follows.

\\.\DISPLAY1
\\.\DISPLAY2

Now if I call Disable on the second display, the ScreenName property in the DisplayScreen class will be: \.\DISPLAY2

So far things are working and the second display will be disabled.
If I now call 'WindowsDisplayAPI.Display.GetDisplays()' I will have a list of 1 display and it's 'ScreenName' will be:
\\.\DISPLAY1

However, I need to call 'WindowsDisplayAPI.UnAttachedDisplay.GetUnAttachedDisplays()' to get the disabled Display I want to turn back on and it's 'ScreenName' is now also:
\\.\DISPLAY1

This means that when I call Display.Enable, the 'ScreenName' property in the DisplayScreen class is: \.\DISPLAY1

So now the API is enabling the Display that's already active and not the second display. I am getting the correct display to enable, but because the 'ScreenName' is now the same as the active display's 'ScreenName' the wrong display is being made active due to the use of ScreenName when calling 'displaySetting.Save'. This call can be found at:
file: DisplayScreen.cs
line: 114

I first thought maybe it's because I'm in a Win10 VM, but I made a WPF demo project to test this and I get the same behavior on my main Windows 10 Desktop.

Link to demo project: https://github.com/Nicks182/WpfDisplayTest

Short video of the WPF demo: https://www.youtube.com/watch?v=2SBjikuNDBU

Error getting monitor friendly names when using remote desktop

Error Message:The parameter is incorrect.
Trace: at WindowsDisplayAPI.DisplayConfig.PathInfo.GetPathInfos(QueryDeviceConfigFlags flags, DisplayConfigTopologyId& topologyId)
at WindowsDisplayAPI.DisplayConfig.PathDisplayTarget.GetDisplayTargets()
at Application1.Helper.ScreenHelper.GetScreenList() in c:\agent_work\2\s\Application1\Main\ScreenList\Helper\ScreenHelper.cs:line 21

[Request] New release

Hello,
First, I would like to thank you for your library. It is very useful.
I saw that last release was on Feb 10, 2020 and since, there has been 7 commits.
Can you please release a new version for nugget ?
Thank you.

Set Orientation?

More of a question than an issue, can we set the orientation?
I see the DisplayOrientation, but can we set? Or just a get?

display.GetScreen() not available under WPF .net core ?

I have all references under a WPF .net core 6 project and cannot access display.GetScreen()

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net6.0-windows10.0.22000.0</TargetFramework>
    <Nullable>enable</Nullable>
    <UseWPF>true</UseWPF>
    <UseWindowsForms>true</UseWindowsForms>
    <SupportedOSPlatformVersion>10.0.19041.0</SupportedOSPlatformVersion>

Anything I am missing?

Unhandled exception when desktop composition is disabled

Excellent library, I have used it for many months and I never had an error. Exceeding this
System.ComponentModel.Win32Exception (0x80004005): Unsupported request
in WindowsDisplayAPI.DisplayConfig.PathInfo.GetPathInfos(QueryDeviceConfigFlags flags, DisplayConfigTopologyId& topologyId)
in WindowsDisplayAPI.DisplayConfig.PathDisplayTarget.GetDisplayTargets()
in ...

Question - Get the bounds of a monitor?

I would like to get the bounds of a monitor (height, width and size) but unsure how to get it.
If you do not mind, could you please point me in the right direction?

Thank you in advance.

DeviceContext: Enable All results in Exception

Trying this awesome package I stumbled over an error. I thought I report it here.

I use nuget package version 1.3.0.13. Im on win10 and run a winforms project with creating a "console build". i use vs 2019 and .net framework 4.7.2.

I start the programm just like in the example and things work but when i try the DeviceContext: Enable All option an exception occurs

console: ModeChangeException - Error: [Failed]: Applying saved settings failed.

visual studio output: Exception thrown: 'WindowsDisplayAPI.Exceptions.ModeChangeException' in WindowsDisplayAPI.dll

stacktrace from exception from debugger:

at WindowsDisplayAPI.DisplaySetting.Save(DisplayDevice display, Boolean reset)
at WindowsDisplayAPI.UnAttachedDisplay.Enable(DisplaySetting displaySetting, Boolean apply)
at WindowsDisplaySample.Program2.<>c.b__0_4() in F:\src\kwm\kwm\exaples.cs:line 117
at WindowsDisplaySample.ConsoleNavigation.<>c__DisplayClass0_0.b__0(Object index) in F:\src\kwm\kwm\exaples.cs:line 339
at WindowsDisplaySample.ConsoleNavigation.PrintObject[T](T[] objects, Action`1 action, String title, String message) in F:\src\kwm\kwm\exaples.cs:line 391

DisplayConfig ERROR_NOT_SUPPORTED - "The request is not supported exception" Windows 7

If I run the following code on my Windows 7 virtual machine, I get the following Exception:

foreach (Display display in Display.GetDisplays())
{
	monitors.Add(new MonitorInfoViewModel(display));
}

public MonitorInfoViewModel(Display display)
{
	AdapterDeviceName = display.Adapter.DeviceName;
	PreferredResolution = display.SavedSetting.Resolution;
	ActualResolution = display.CurrentSetting.Resolution;

	FriendlyName = display.ToPathDisplayTarget().FriendlyName;
}

Message 'Die Anforderung wird nicht unterstützt' StackTrace ' bei WindowsDisplayAPI.DisplayConfig.PathInfo.GetPathInfos(QueryDeviceConfigFlags flags, DisplayConfigTopologyId& topologyId)
bei WindowsDisplayAPI.DisplayConfig.PathDisplayTarget.GetDisplayTargets()
bei WindowsDisplayAPI.DisplayDevice.ToPathDisplayTarget()

system

oracle

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.