This commit is contained in:
CortexCore
2025-04-14 15:39:28 +08:00
parent c1273357de
commit d8b8ddb8b6
23 changed files with 447 additions and 116 deletions

View File

@@ -0,0 +1,29 @@
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using UnityEngine;
namespace BITKit
{
public class GetWindowsWallPaper
{
[DllImport("user32.dll", SetLastError = true)]
static extern bool SystemParametersInfo(int uAction, int uParam, StringBuilder lpvParam, int fuWinIni);
const int SPI_GETDESKWALLPAPER = 0x0073;
const int MAX_PATH = 260;
public static string GetWallpaperPath()
{
StringBuilder sb = new StringBuilder(MAX_PATH);
if (SystemParametersInfo(SPI_GETDESKWALLPAPER, sb.Capacity, sb, 0))
{
return sb.ToString();
}
return null;
}
}
}