C++工作笔记-Windows下查找窗口句柄并让其显示在桌面

程序运行截图如下:


此处分2种情况,

1.句柄处于最小化,

2.句柄处于非最小化。


代码如下:

#include <windows.h>
#include <iostream>

using namespace std;

int main(){
	HWND hWnd = FindWindow(NULL, L"Qt 助手");
	if (IsIconic(hWnd)){
		cout << "目标程序处于最小化\n";
		ShowWindow(hWnd, SW_SHOWNORMAL);
	}
	SetForegroundWindow(hWnd);
	getchar();
	return 0;
}


猜你喜欢

转载自blog.csdn.net/qq78442761/article/details/80759361