惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
爱范儿
爱范儿
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
雷峰网
雷峰网
V
V2EX
博客园_首页
Engineering at Meta
Engineering at Meta
博客园 - 聂微东
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Apple Machine Learning Research
Apple Machine Learning Research
GbyAI
GbyAI
H
Help Net Security
A
About on SuperTechFans
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Blog — PlanetScale
Blog — PlanetScale
W
WeLiveSecurity
云风的 BLOG
云风的 BLOG
D
Docker
Security Archives - TechRepublic
Security Archives - TechRepublic
Help Net Security
Help Net Security
N
News and Events Feed by Topic
Simon Willison's Weblog
Simon Willison's Weblog
G
Google Developers Blog
A
Arctic Wolf
T
The Blog of Author Tim Ferriss
博客园 - 叶小钗
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Google DeepMind News
Google DeepMind News
博客园 - 三生石上(FineUI控件)
aimingoo的专栏
aimingoo的专栏
Hacker News: Ask HN
Hacker News: Ask HN
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 司徒正美
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
P
Privacy International News Feed
T
Troy Hunt's Blog
T
Tenable Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Recorded Future
Recorded Future
F
Fortinet All Blogs
D
DataBreaches.Net
B
Blog
T
Threat Research - Cisco Blogs
MyScale Blog
MyScale Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
The GitHub Blog
The GitHub Blog
Security Latest
Security Latest
M
MIT News - Artificial intelligence

博客园 - Eric-Liu

Docker Desktop for Windows ChatGLM本地部署 Llama本地部署 StableDiffusion本地部署 Python-CUDA-cuDNN安装 Python实现视频桌面 基于BERT进行文本分类 启用VTX技术支持启动android的虚拟机 - 报错 新机上岗 Core i7-4790 @ 3.60GHz 四核 / 16 GB ( 金士顿 DDR3 1866MHz ) / GeForce GTX 970 ( 4 GB / 七彩虹 ) VBS发送邮件-1 Oracle数据库编译存储过程挂死问题解决办法 Windows 7丢失用户、密码解决办法-我体验了! 批处理实现从Excel导入Oracle Windows Gadget开发之运行外部程序 - Eric-Liu - 博客园 VirtualBox自动重启之谜 拆分五笔字库,提高导入到google拼音的速度 写个设置命令的VBS脚本工具。 - Eric-Liu - 博客园 CMD下一个命令遍历目录删除相同垃圾文件 SQL注入之脚本篇-FOR ACCESS数据库
Python实现Windows下的视频壁纸
Eric-Liu · 2023-08-20 · via 博客园 - Eric-Liu
import sys

import win32gui
import subprocess
import time


def pretreatmentHandle():
    hwnd = win32gui.FindWindow("Progman", "Program Manager")
    workerW1 = None
    while 1:
        workerW1 = win32gui.FindWindowEx(None, workerW1, "WorkerW", None)
        if not workerW1:
            continue
        # print('workerW1: ', workerW1)
        subWinOfWorkerW1 = win32gui.FindWindowEx(workerW1, None, "SHELLDLL_DefView", None)
        if not subWinOfWorkerW1:
            continue
        # print('subWinOfWorkerW1: ', subWinOfWorkerW1)
        workerW2 = win32gui.FindWindowEx(None, workerW1, "WorkerW", None)
        if workerW2:
            # print('workerW2: ', workerW2)
            win32gui.SendMessage(workerW2, 0x0010, 0, 0)  # WM_CLOSE
        break
    return hwnd


if __name__ == "__main__":
    video_path = "D:\\Documents\\2439226.mp4"
    parameters = ["D:\\Downloads\\ffmpeg6.0\\bin\\ffplay.exe", video_path, "-noborder", "-x", "3440", "-y", "1440",
                  "-fs", "-loop", "0"]

    time.sleep(0.2)

    startup_info = subprocess.STARTUPINFO()
    process = subprocess.Popen(parameters, startupinfo=startup_info)
    time.sleep(0.2)

    # 获取桌面管理器的窗口
    program_win_h = win32gui.FindWindow("Progman", "Program Manager")
    print("原来的program窗口句柄:", program_win_h)
    # 发送消息新增Workrw窗口,有三/四层,顶层为Workrw,并且在Program窗口的上面
    win32gui.SendMessageTimeout(program_win_h, 0x052C, 0, 0, win32gui.ILD_NORMAL, 300)

    # 将视频播放窗口设置为Program窗口的子窗口
    time.sleep(1)
    program_win_h = win32gui.FindWindow("Progman", "Program Manager")
    print("分离后的program窗口句柄:", program_win_h)

    video_h = win32gui.FindWindow("SDL_app", None)
    win32gui.SetParent(video_h, program_win_h)
    pretreatmentHandle()

    process.wait()