获取win10锁屏图片
win10 的锁屏图片切实不错!下载下来做个背景也不错!fwt做了一个小脚本获取,经测试确实不错!!直接运行,获取到的图片在桌面!
SourcePath := A_AppData . "\..\Local\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets\"
SavePath := A_Desktop . "\lockimg\"
IfNotExist, % SavePath
FileCreateDir, % SavePath
pToken := Gdip_Startup()
Loop, Files, % SourcePath . "*"
{
img := Gdip_CreateBitmapFromFile(A_LoopFileFullPath)
w := Gdip_GetImageWidth(img)
if ( w > 800 )
h := Gdip_GetImageHeight(img)
else
Continue
if ( w > h )
FileCopy, % A_LoopFileFullPath, % SavePath . A_LoopFileName . ".jpg"
}
Gdip_Shutdown(pToken)
; 函数列表
Gdip_Startup()
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
if !DllCall("GetModuleHandle", "str", "gdiplus", Ptr)
DllCall("LoadLibrary", "str", "gdiplus")
VarSetCapacity(si, A_PtrSize = 8 ? 24 : 16, 0), si := Chr(1)
DllCall("gdiplus\GdiplusStartup", A_PtrSize ? "UPtr*" : "uint*", pToken, Ptr, &si, Ptr, 0)
return pToken
}
Gdip_Shutdown(pToken)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
DllCall("gdiplus\GdiplusShutdown", Ptr, pToken)
if hModule := DllCall("GetModuleHandle", "str", "gdiplus", Ptr)
DllCall("FreeLibrary", Ptr, hModule)
return 0
}
Gdip_CreateBitmapFromFile(sFile, IconNumber=1, IconSize="")
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
PtrA := A_PtrSize ? "UPtr*" : "UInt*"
DllCall("gdiplus\GdipCreateBitmapFromFile", Ptr, &sFile, PtrA, pBitmap)
return pBitmap
}
Gdip_GetImageWidth(pBitmap)
{
DllCall("gdiplus\GdipGetImageWidth", A_PtrSize ? "UPtr" : "UInt", pBitmap, "uint*", Width)
return Width
}
Gdip_GetImageHeight(pBitmap)
{
DllCall("gdiplus\GdipGetImageHeight", A_PtrSize ? "UPtr" : "UInt", pBitmap, "uint*", Height)
return Height
}
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。

