1
This commit is contained in:
29
Src/Unity/Scripts/Win64/GetWindowsWallPaper.cs
Normal file
29
Src/Unity/Scripts/Win64/GetWindowsWallPaper.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user