[办公]获取win10锁屏图片

获取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
}

 

 

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。

给TA捐赠
共{{data.count}}人
人已捐赠
案例

[办公]分享一个我自用的快捷启动菜单

2017-8-28 20:58:52

案例

[办公][文件][FSO]文件夹操作

2017-10-27 16:06:34

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
❯
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索