-
Notifications
You must be signed in to change notification settings - Fork 0
Class Desktop
Kristian Virtanen edited this page Oct 28, 2024
·
8 revisions
The Desktop
class provides functionality to retrieve the dimensions of the primary screen (desktop) and change the desktop wallpaper. It uses the SystemParametersInfo
function from the Windows API (user32.dll
) to update the wallpaper.
It also manages error handling through the LastError
property, which stores the most recent error message if an operation fails.
- Description: Returns the height of the primary screen (desktop) in pixels.
-
Example:
1080
- Differences from orig. SB: none.
-
Description: Stores the last error message, if any operation fails, including a timestamp in
yyyy-MM-dd HH:mm:ss
format. -
Example:
"2024-10-16 14:30:00: Failed to set wallpaper. Win32 Error Code: 87 - The parameter is incorrect."
- Differences from orig. SB: Not available at original SB.
- Description: Returns the width of the primary screen (desktop) in pixels.
-
Example:
1920
- Differences from orig. SB: none.
- 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:
true
if successful,false
if an error occurred. -
On Error: If the operation fails,
LastError
will contain the reason. -
Differences from orig. SB: Original does not return anything while SBOE works as boolean function, returning
true
orfalse
.