0

我有以下代码:

MessageBox(NULL, NULL, (LPCWSTR)FindWindow(NULL, L"Untitled - Notepad"), MB_OK);

如何使消息框的标题成为记事本的窗口句柄?有没有任何有效和简单的方法可以使用 C++ 做到这一点?

4

1 回答 1

4

这:

HWND hwnd = FindWindowW(NULL, L"Untitled - Notepad");
std::wostringstream ss;
ss << std::hex << hwnd;
std::wstring strTitle = ss.str();
MessageBoxW(NULL, L"Caption message", strTitle.c_str(), MB_OK);
于 2020-09-03T18:49:03.400 回答