https://github.com/lust4life/display-resolution
set display resolution from powershell on windows using win32 api
https://github.com/lust4life/display-resolution
display-resolution screen-resolution
Last synced: about 2 months ago
JSON representation
set display resolution from powershell on windows using win32 api
- Host: GitHub
- URL: https://github.com/lust4life/display-resolution
- Owner: lust4life
- License: mit
- Created: 2020-07-20T15:31:57.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-12-22T23:13:05.000Z (over 1 year ago)
- Last Synced: 2025-02-28T00:36:28.891Z (2 months ago)
- Topics: display-resolution, screen-resolution
- Language: C#
- Homepage:
- Size: 18.6 KB
- Stars: 12
- Watchers: 2
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Change Display Settings
Changes display settings in *Windows* from Powershell or .Net tool.# Usage
## PowershellInstall
``` powershell
Import-Module set-display-resolution.psm1
```Usage:
``` powershell
Set-DisplayResolution(1024,768,CDSFlags.SetPrimary);write-host Get-DisplayResolution()
```## .Net Tool
Install:
```
dotnet tool install --global ChangeDisplaySettings
```Usage:
```
ChangeDisplaySettings -w 1024 -h 768...
ChangeDisplaySettings --help
...
-w, --width Required. Width of the screen
-h, --height Required. Height of the screen
-t, --test (Default: false) Test resolution change or actually perform the change.
--help Display this help screen.
--version Display version information.
```# Resources
- https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-changedisplaysettingsa
- https://github.com/tpn/winsdk-10/blob/9b69fd26ac0c7d0b83d378dba01080e93349c2ed/Include/10.0.10240.0/um/WinUser.h#L12522
- https://github.com/tpn/winsdk-10/blob/9b69fd26ac0c7d0b83d378dba01080e93349c2ed/Include/10.0.10240.0/um/wingdi.h#L2315
- https://devblogs.microsoft.com/scripting/use-powershell-to-interact-with-the-windows-api-part-1/