windows api学习笔记-给指定的应用程序发送消息

2022-05-09 11:40:58 浏览数 (1)

代码语言:javascript复制
#include <windows.h>
#include <iostream>
using namespace std;

int main()
{
	//HWND hWnd = ::FindWindow("Notepad",NULL);
	HWND hWnd = ::FindWindow(NULL,"a.txt - 记事本");
	if(hWnd != NULL)
	{
		::SendMessage(hWnd,WM_CLOSE,0,0);
	}
	char a;
	cin>>a;
	return 0;
}

0 人点赞