#include <iostream>
#include <Windows.h>
#include <windows.system.h>
using namespace std;
#define WM_COPYDATA 0x004A
int main()
{
SetConsoleTitle(L"C");
HWND hWnd = FindWindow(NULL,L"CshapMessage");
if (hWnd)
{
COPYDATASTRUCT cpd;
cpd.dwData = 100;
cpd.cbData = 1;
cpd.lpData = NULL;
SendMessage(hWnd, WM_COPYDATA, 0, (LPARAM)&cpd);
cout << "successed" << endl;
}
else
{
cout << "failed" << endl;
}
}
C++向外传值
最新推荐文章于 2023-01-03 10:29:38 发布