Network Management Xiaojia/sysadm.cc
There is a friend named Xiaowang who recently followed a variety show "Annual Comedy Competition" with his girlfriend.
Since the broadcast of this program, the format has become younger and more fun, and the script is also full of imagination, unlimited creativity and uniqueness. It is very popular among young people nowadays.
Among them is a sketch called "Sir, Come Out", which the creator calls himself a trap comedy. After it was aired, it suddenly became a hit on the Internet.
No, Xiaowang and his girlfriend were also fascinated and addicted. They asked me if they could put this video on the desktop so that they could watch it and look cool again.
Is it so obsessive?
I really didn’t believe it, but after watching the magical dance steps and coquettish moves, I couldn’t get out of them again!
Hehe, that’s right, I have been successfully brainwashed, and now I often want to imitate those dance moves.
Nowadays, most young people don’t smoke or drink, so they just have these kinds of fun. I understand!
I told Xiaowang that there are many dynamic desktop wallpaper programs, just download them and use them.
But the reply I got was that these software are either free or contain private goods, which is not very reassuring. I asked if there is a more reliable method.
Yes, so I studied it for several days, and finally succeeded in using this magical dance video as a dynamic desktop wallpaper!
At the end of this article, there is a self-made program to download, which is free, safe and reliable, and does not contain any private goods~
experiment platform
Windows 10 (on by default Aero
)
target effect
You can basically play videos on the desktop to achieve the effect of a dynamic desktop.
At the same time, it does not hinder daily operations, such as clicking and moving desktop icons.
Tool introduction
If you want to do your job well, you must use your tools. In addition to programming tools, before we officially start to understand the principles, we need to use the "window handle grabbing tool": Microsoft Spy++
.
It is Vistual Studio
a utility from that provides a graphical view of your system's processes, threads, windows, and messages.
Of course, if you are familiar with this, you can also use other window handles to view tools.
But if you don’t know what a window handle is, that’s okay. I’ll explain it to you briefly, and you’ll probably understand it.
First of all, we need to know that the window (or form) is the most commonly used and basic container carrier in the system. There are many different controls in the window. They are all used for operating system functions or interacting with the user. Interactive.
Windows are important, so how do we manage these windows?
It's very simple. The system will assign an ID to these windows, and this ID is called a handle.
The handles of these windows are like ID card numbers. When we want to operate them, we only need to tell the system their ID card IDs, which are window handles.
Then Spy++
it can provide a graphical reference so that we know which window has which handle.
Desktop wallpaper principle
In fact, our system is composed of many, many windows, some are visible, some are invisible (hidden or transparent), some are visible but cannot be accessed directly, and some can be accessed even if they are invisible. After the operation, all these windows are stacked on top of each other and finally appear in front of us.
You just need to imagine these windows as multiple different pieces of glass, standing in front of you at multiple levels from near to far, like looking in a mirror, some transparent and some opaque.
So for the desktop, it is also regarded as a piece of glass (a window), but it is a bit special, and there are several small glasses (sub-windows) inside.
Therefore, after roughly understanding the concept of a window, we can use Spy++
to observe what it specifically looks like.
The original appearance of the desktop window
As shown in the figure below, by Spy++
expanding the handle tree of the current window, you can easily understand how the dolls are arranged in the desktop window.
At the top is the handle of the desktop window, and there are many sub-windows below it.
The most important thing that is useful to us is the sub Program Manager
-window named. It is exactly the desktop background we are looking for, and it includes sub-windows containing wallpapers and icons.
Simply put, the desktop window is as hierarchical as the following.
|- "Program Manager" Progman // 总体桌面
|--- "" SHELLDLL_DefView // 负责显示桌面图标
|----- "FolderView" SysListView32 // 控制桌面图标排列顺序
|------- "" SysHeader32 // 隐藏窗口,功能不详
These sub-windows "" SHELLDLL_DefView
are the desktop icon windows.
To put it simply, it is in quotation marks 窗口标题
, and it is followed by 类名
, for example, "Program Manager"
it is the window title, and Progman
it is the class name.
Knowing the window title and class name will be very helpful for us to find and locate the window, so that we can operate it conveniently.
Progman
Is it okay to embed it directly in the window?
Based on the previous introduction, we can easily draw a conclusion. Since the desktop wallpaper and icons belong to different sub-windows, can we insert our own program window between them so that it can be displayed below the icon?
The theoretical idea is correct, but after my actual test, it is a pity that such an effect cannot be achieved!
Set the program window as Progman
a child window of . Although it goes to the end of all windows, it cannot be displayed behind the icon.
So what's the problem?
Multiple desktops pop upWorkerW
It turns out that we are using Windows 10 system. Although it supports effects by default , it also has a new function of multiple desktops, which you can see Aero
by just pressing the key.Win + Tab
This multi-desktop function will cause wonderful changes in the desktop window, and the system will generate multiple WorkerW
windows.
We can simply understand this WorkerW
as a small window for switching the desktop, but now there are many.
Among the many windows that have come out WorkerW
, one of them will Progman
"grab" the sub-window under the original window, just like the picture below.
Okay, this is a bad thing!
Our Progman
method of finding the desktop icon background according to the window is completely useless!
So why do you have to make so many of WorkerW
them? Can't you use them happily Progman
?
In fact, the official explanation is that in order to make the desktop switch show a smooth transition effect, the design enables multiple WorkerW
windows, otherwise the effect will be so bad that you will want to smash the computer.
Okay, everyone knows the truth, so what’s the next step?
Since Progman
the sub-window under has been "snatched", can we try to find this SHELLDLL_DefView
sub-window with class WorkerW
, and then put the window of our own program behind it as a sub-window?
Try embedding the program windowWorkerW
After some more tossing, I found that even if I found the target WorkerW
and placed the program window underneath it, it still didn't work.
As shown in the figure below, although the program window has moved to the end of all windows, it still stays in front of the desktop icons. The effect Progman
is the same as hanging the program window below.
Now I was confused, why couldn’t this work, and what about that?
In fact, there is a routine here, and this routine really made me think about it for a long, long time!
What's the trick? Let's look down!
I consulted a lot of information on the Internet, and through constant experiments I found that except for those with child windows WorkerW
, all others WorkerW
are hidden.
The actually effective approach is that we need to embed the program window on the second visible and non-hidden WorkerW
one .
Note that it has two characteristics. The first is that it is ranked second and does not contain sub-windows. The second is that it has visible and non-hidden attributes.
Make WorkerW
the window visible and transparent
As we said before, pressing Win+Tab
the key can switch multiple desktops. When we switch like this, the system will generate multiple WorkerW
windows for transition switching effects.
So we can use a program to simulate pressing Win+Tab
the key.
However, after I tried to simulate the keys, I found that the window flickered, which was not an ideal state, so I found information on the Internet.
According to online information, Windows has a system to retain messages. When we Progman
send 0x052C
a message to the window, the desktop will generate a transparent WorkerW
window, and at the same time, Progman
the child window of will be transferred to this newly generated window WorkerW
.
This is exactly what we saw earlier, the effect of the child window being "grabbed over".
It should be noted that this is Vista
only valid in later versions. Well, it can be understood as Aero
a system that turns on the effect.
I VB
implemented it easily using code, like below.
' 获取 Progman 句柄
lngDesktopHwnd = FindWindow("Progman", vbNullString)
' 然后向 Progman 发送 0x052C 使其产生 WorkerW
SendMessage lngDesktopHwnd, &H52C, 0, 0
Traverse the search target WorkerW
window
After generating the window we want WorkerW
, we have to find a way to find the target window, which is the second visible WorkerW
window.
Remember, this WokerW
window is visible but not hidden, and does not contain any child windows.
My traversal algorithm is usable but very rough. You can simply refer to it and improve it yourself.
' 获取桌面句柄
lngDesktopHwnd = GetDesktopWindow
' 获得第一个 WorkerW 窗口句柄
lngWorkerW = FindWindowEx(lngDesktopHwnd, 0, "WorkerW", vbNullString)
' 定义临时类名,用于对比查找多个同级的 WorkerW 窗口
Dim lpClassName As String
' 遍历所有 WorkerW 直至找到不拥有 SysListView32 子窗口的那个 WorkerW 为止!
Do While lngWorkerW > 0
If IsWindowVisible(lngWorkerW) Then
lngShellDll = FindWindowEx(lngWorkerW, 0, "SHELLDLL_DefView", vbNullString)
If lngShellDll = 0 Then
Exit Do
Else
' 查找下一个同级的类窗体句柄
lpClassName = Space(255)
Do While UCase(Left(lpClassName, 7)) <> UCase("WorkerW")
lngWorkerW = GetWindow(lngWorkerW, GW_HWNDNEXT)
GetClassName lngWorkerW, lpClassName, 255
Loop
End If
Else
' 查找下一个同级的类窗体句柄
lpClassName = Space(255)
Do While UCase(Left(lpClassName, 7)) <> UCase("WorkerW")
lngWorkerW = GetWindow(lngWorkerW, GW_HWNDNEXT)
GetClassName lngWorkerW, lpClassName, 255
Loop
End If
Loop
Make the program window a WorkerW
child window of the target window
See, as shown in the picture below, our program window has moved WorkerW
below the second visible one.
The reference code is as follows:
' 将程序窗口设定为 WorkerW 的子窗口,WorkerW 成为父窗口
lngOriginalParentHwnd = SetParent(Me.hwnd, lngWorkerW)
' 最后在程序退出时别忘记再变回来
lngTmpHwnd = SetParent(Me.hwnd, lngOriginalParentHwnd)
Finally, we saw this effect, the window finally ran behind the icon, yeah!
Effect demonstration
There is still a lot of work to be done in the future, such as player operation control, foreground layout, etc.
However, these complicated things are not a major problem, as long as we can basically achieve dynamic video playback on the desktop.
Just like below, the effect is pretty good.
Click Browse and select the video file.
Load the video first, then click play.
Here is an animation to show the actual effect. You can see that the video is played behind the icon.
I have created two versions of the program, and the comparison is as follows:
-
WindowsMediaPlayer
:Windows
There is no need to install an additional player that comes with the system, but the playback effect may be poor. -
VLCMediaPlayer
: Need to installVLC
the player separately, but the playback effect is good.When installing the player, choose a 32-bit one, and remember to install it
ActiveX 插件
! !
The method of use is very simple. In addition to installing the player separately, you only need to unzip it and use it directly after downloading. It is green and environmentally friendly.
Network administrator Xiao Jia's MP4 dynamic wallpaper program (WindowsMediaPlayer).7z (106K)
Download link: https://pan.baidu.com/s/1HYATSyA3H2YNPivAu2i6aw
Extraction code: <Follow the official account and send 000903 or Sir, please come out>
Network administrator Xiaojia's MP4 dynamic wallpaper program (VLCMediaPlayer).7z (106K)
Because VLC
the installation package is large, this compressed package does not contain VLC
the installation package. Please download it from the official website link below.
Download link: https://pan.baidu.com/s/1uiSTHTdujRD62sPuj7M03A
Extraction code: <Follow the official account and send 000903 or Sir, please come out>
VLC Media Player(vlc-3.0.16-win32).exe (40M)
The latest version 3.0.16
, please remember to install 32
it.
Download link: https://www.videolan.org/
"Sir, Please Come Out" Demonstration Video Clip of Demonic Dance Steps
Download link: https://pan.baidu.com/s/1PgIkBv–E3A5Dwuwt9VWvA
Extraction code: <Follow the official account and send 000903 or Sir, please come out>
write at the end
A lot of verbosity has been said before, the window has been displayed behind the desktop icon, and the subsequent work will continue from here.
Although it seems simple to add a player to the window and then give it some operation control functions during playback, at first, in order to save time, I just Windows Media Player
used the default one that comes with the system. Naturally, sometimes its playback The effect is not very ideal, especially for those who are demanding.
Of course, if I have time in the future, I will improve this problem and use libVLC
as the playback engine.
(PS: It has been initially added, the download link is in front of ~)
In addition to the player, the foreground layout effect is also quite challenging, such as hanging Logo
a clock or something behind the desktop icon and in front of the video.
Of course, this will be something I can do when I have free time in the future.
I need to declare to my friends here that since I am also a novice, it took me a lot of time to search for information and test it, so the final effect may not be comparable to those of commercial software. Please bear with me, friends.
Well, at least it’s satisfactory to me. My classmate Xiaowang has also tried it, and my relationship with my girlfriend has warmed up, and the relationship has taken a step forward. It can be considered that I have accomplished a good thing!
If you like it or need it, feel free to take it and take it!
But ha, don’t forget to follow, like and retweet!
I wish you all that your New Year wishes will come true and everything goes well, okay~
Network Management Xiaojia/sysadm.cc