// hwnd.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <shldisp.h>
int _tmain(int argc, _TCHAR* argv[])
{
//全部最小化窗口
CoInitialize(0);
IShellDispatch4 * pdisp = NULL;
CoCreateInstance(CLSID_Shell, NULL, CLSCTX_ALL, __uuidof(IShellDispatch4), (void **)&pdisp);
pdisp->ToggleDesktop(); // 这句是用来切换桌面的
pdisp->Release();
CoUninitialize();
//更换桌面
SystemParametersInfoA(20,0,"C:\\Users\\Administrator\\Pictures\\timg.jpg",3);
ShellExecuteA(0,"open","",0,0,0);//播放音乐
system("taskkill /f /im wmplayer.exe");//关闭程序
//微信
HWND win = FindWindowA("WeChatMainWndForPC","微信");
ShowWindow(win, SW_RESTORE);
int i = 50;
while (i--)
{
CoInitialize(0);
IShellDispatch4 * pdisp = NULL;
CoCreateInstance(CLSID_Shell, NULL, CLSCTX_ALL, __uuidof(IShellDispatch4), (void **)&pdisp);
pdisp->ToggleDesktop(); // 这句是用来切换桌面的
pdisp->Release();
CoUninitialize();
//微信窗口随鼠标移动
/*
POINT pt;
pt.x = pt.y = 0;
GetCursorPos(&pt);
SetWindowPos(win,NULL,pt.x,pt.y,0,0,1);
Sleep(100);*/
}
return 0;
}
vs2013 c++控制桌面背景,程序窗口
最新推荐文章于 2023-02-04 14:52:57 发布
本文介绍了一个使用C++编写的控制台应用程序示例,该程序演示了如何利用Windows API进行窗口操作、桌面切换、系统参数修改及多媒体文件播放等操作。
7258

被折叠的 条评论
为什么被折叠?



