-
Notifications
You must be signed in to change notification settings - Fork 0
Class Clock
Kristian Virtanen edited this page Oct 16, 2024
·
11 revisions
The Desktop class provides functionality to retrieve the dimensions of the primary screen (desktop) and change the desktop wallpaper. The class utilizes Windows API (SystemParametersInfo from user32.dll) to set the wallpaper.
It also provides error handling through the LastError property, which captures the most recent error message, if any operation fails.
- Description: Returns the width of the primary screen (desktop) in pixels.
-
Example:
1920
- Description: Returns the height of the primary screen (desktop) in pixels.
-
Example:
1080
-
Description: Stores the last error message, if any operation fails, including a timestamp in
yyyy-MM-dd HH:mm:ssformat. -
Example:
"2024-10-16 14:30:00: Failed to set wallpaper. Win32 Error Code: 87 - The parameter is incorrect."
- Description: Sets the desktop wallpaper to the specified file path or URL.
-
Parameters:
-
fileOrUrl: The file path or URL of the image to set as wallpaper.
-
-
Returns:
trueif successful,falseif an error occurred. -
On Error: If the operation fails,
LastErrorwill contain the reason.