Skip to content

Add cmdlets to play with window position#3

Merged
PrzemyslawKlys merged 35 commits intomasterfrom
AddMoreCmdlets
Mar 21, 2025
Merged

Add cmdlets to play with window position#3
PrzemyslawKlys merged 35 commits intomasterfrom
AddMoreCmdlets

Conversation

@PrzemyslawKlys
Copy link
Copy Markdown
Member

@PrzemyslawKlys PrzemyslawKlys commented Mar 19, 2025

This PR adds 2 cmdlets for use in PowerShell

  • Get-DesktopWindow
  • Set-DesktopWindow
Get-DesktopWindow | Format-Table *

image

Set-DesktopWindow -Name '*Zadanie - Notepad' -Height 800 -Width 1200 -Left 100
Set-DesktopWindow -Name '*Zadanie - Notepad' -State Maximize

In C# adds multiple methods to use in C#

var manager = new WindowManager();
manager.GetWindows
manager.SetWindowPosition
manager.CloseWindow
manager.MinimizeWindow
manager.MaximizeWindow
manager.RestoreWindow

- Introduced methods for getting shell window handle, enumerating windows, and retrieving window text.
- Added functionality to check window visibility and manipulate window positions.
- Enhanced display settings management with new extern method signatures.
- Introduced WindowMessage enum for system command messages.
- Added WindowCommand enum with various window commands.
- Introduced WindowInfo class to represent basic window information.
- Added WindowPosition class inheriting from WindowInfo to include position details.
- Implement CmdletGetDesktopWindow class to get information about visible windows.
- Support filtering windows by title using wildcards.
- Include examples in the documentation for usage.
…tions

- Implement CmdletGetDesktopWindowPosition class to get the position of desktop windows.
- Support filtering of windows by title using wildcards.
- Include examples in the documentation for usage.
- Implement CmdletSetDesktopWindowPosition to set the position of a desktop window.
- Support identifying windows by title with wildcard matching.
- Include parameters for window title, left position, and top position.
- Add processing logic to move the specified window to the desired coordinates.
- Implement Cmdlet to set the state of desktop windows (close, minimize, maximize, restore).
- Support for identifying windows by title with wildcard matching.
- Include error handling for window state changes.
…tion

- Added 'Get-DesktopWindow', 'Get-DesktopWindowPosition', 'Set-DesktopWindowPosition', and 'Set-DesktopWindowState' to CmdletsToExport
- Updated module description to reflect window management capabilities
- Corrected Tags and IconUri in PrivateData section
- Implement methods to get, set, close, minimize, maximize, and restore windows.
- Include functionality to retrieve all visible windows with optional title filtering.
- Add support for getting and setting window positions.
- Improved handling of wildcard patterns in window title filtering.
- Added support for wildcards at the start, end, and middle of the pattern.
- Consolidate CmdletsToExport array formatting
- Refine module description for accuracy
- Update ModuleVersion to '2.0.2'
- Adjust Tags for consistency
- Import DesktopManager module
- Retrieve and format desktop windows in a table
- Updated summary and description to reflect both position and size adjustments.
- Added examples demonstrating setting window size along with position.
- Modified ShouldProcess message to include width and height parameters.
- Updated SetWindowPosition method call to include width and height.
- Moved Width and Height properties into the WindowInfo class for better encapsulation.
- Updated documentation to reflect changes in property locations.
- Ensured WindowPosition class remains intact for position and size representation.
- Added optional width and height parameters to SetWindowPosition method
- Updated method implementation to handle resizing of windows
- Improved error handling with an exception for failed position setting
- Enhanced GetWindows method to retrieve and store the position of each window.
- Added Left, Top, Right, and Bottom properties to WindowInfo for position data.
…wPosition method to identify the primary monitor for each window.
- Introduced MonitorIndex to track the primary monitor index.
- Added MonitorDeviceId for identifying the monitor device.
- Included MonitorDeviceName for the monitor's name.
- Added IsOnPrimaryMonitor to indicate if the window is on the primary monitor.
- Introduced WindowState enum with values for Normal, Minimize, Maximize, and Close.
- Provides a structured way to manage and reference window states in the application.
- Reorganized code structure for better readability
- Added summary comments for properties and methods
- Ensured consistent formatting and spacing
- Adjusted Format-Table to display all properties of desktop windows
- Modified Set-DesktopWindowPosition to maximize a specific window by name
- Introduced CmdletSetDesktopWindow to manage window position, size, and state.
- Removed CmdletSetDesktopWindowPosition and CmdletSetDesktopWindowState for consolidation.
- Enhanced functionality to support window state changes (minimize, maximize, close, restore).
…etsToExport in DesktopManager.psd1

- Updated CmdletsToExport to streamline available cmdlets
- Removed unnecessary cmdlets for improved clarity
…tting

- Moved window position setting logic inside the process check
- Removed duplicate position setting code
- Added retrieval of window state (minimized, maximized, normal) in GetWindows method.
- Updated SetWindowPosition method to conditionally move or resize windows based on input parameters.
…roperties

- Updated summary for the State property to reflect its purpose.
- Removed ShouldResize and ShouldReposition properties for simplification.
- Introduced GetWindowLong method for retrieving window information.
- Defined constants for window style values (GWL_STYLE, WS_MINIMIZE, WS_MAXIMIZE).
- Replace Set-DesktopWindowPosition with Set-DesktopWindow
- Specify Height, Width, and Left position for the window
@PrzemyslawKlys PrzemyslawKlys merged commit 6643667 into master Mar 21, 2025
2 checks passed
@PrzemyslawKlys PrzemyslawKlys deleted the AddMoreCmdlets branch March 21, 2025 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant