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*) 后面是你要更换的壁纸的路径,用双重反斜杠 \\ !
版权声明:本文标题:用 C++ 在Windows中清空回收站内文件隐藏和显示桌面图标Windows任务栏任务栏时钟更改桌面壁纸 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dianzi/1726197302a1060143.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论