admin管理员组

文章数量:1531271

如果感觉这篇文章帮助到你的话,欢迎捐助我!
bitcoin : bc1qvvkqmwcd7s9fas063htffm76k63rx7f3r9dp4r

清空回收站内文件

#include<windows.h>
#include<WinUser.h>
int main()
{
	SHEmptyRecycleBin(NULL,NULL,NULL);
}

原理:SHEmptyRecycleBin()函数原型

SHEmptyRecycleBin(
HWND hwnd,
LPCTSTR pszRootPath,	//要清空回收站所在驱动器根目录。NULL表示所有驱动器。
DWORD dwFlags);			//清空回收站选项

注意:dwFlags 表示选项,例如:
SHERB_NOCONFIRMATION 不显示确认删除对话框
SHERB_NOSOUND 删除完成后不播放声音

例如

#include<windows.h>
#include<WinUser.h>
int main()
{
	SHEmptyRecycleBin(NULL,NULL,SHERB_NOCONFIRMATION);
}

执行后没有确认删除对话框。

隐藏和显示桌面图标

隐藏桌面图标

#include<windows.h>
#include<WinUser.h>
int main()
{
	HWND hDeskWnd=::FindWindow("Progman",NULL);
	ShowWindow(hDeskWnd,SW_HIDE);
}

运行后如下图:

显示桌面图标

#include<windows.h>
#include<WinUser.h>
int main()
{
	HWND hDeskWnd=::FindWindow("Progman",NULL);
	ShowWindow(hDeskWnd,SW_SHOW);
}

注意: ::FindWindow(“Progman”,NULL); 为获取桌面窗体句柄。

隐藏和显示 Windows 任务栏

隐藏任务栏

#include<windows.h>
int main()
{
	HWND hWinBar = ::FindWindow("Shell_TrayWnd","");
	:: ShowWindow(hWinBar,SW_HIDE);
}

运行后如下图:

显示任务栏

#include<windows.h>
int main()
{
	HWND hWinBar = ::FindWindow("Shell_TrayWnd","");
	:: ShowWindow(hWinBar,SW_SHOW);
}

隐藏和显示任务栏时钟

隐藏任务栏时钟

#include<windows.h>
int main()
{
	HWND hWinBar= :: FindWindow("Shell_TrayWnd",NULL);
	HWND hNotifyWnd = :: FindWindowEx(hWinBar,0,"TrayNotifyWnd",NULL);
	HWND hClockWnd = :: FindWindowEx(hNotifyWnd,0,"TrayClockWClass",NULL);
	::ShowWindow(hClockWnd,SW_HIDE);
}

运行后如下图:

显示任务栏时钟

#include<windows.h>
int main()
{
	HWND hWinBar= :: FindWindow("Shell_TrayWnd",NULL);
	HWND hNotifyWnd = :: FindWindowEx(hWinBar,0,"TrayNotifyWnd",NULL);
	HWND hClockWnd = :: FindWindowEx(hNotifyWnd,0,"TrayClockWClass",NULL);
	::ShowWindow(hClockWnd,SW_SHOW);
}

更改桌面壁纸

#include<windows.h>
#include<bits/stdc++.h>
int main()
{
	SystemParametersInfo (SPI_SETDESKWALLPAPER, 0 , (void*)"C:\\Untitled.png" , 0);
}

注意: (void*) 后面是你要更换的壁纸的路径,用双重反斜杠 \\ !

本文标签: 任务栏站内时钟清空桌面壁纸