0

I have the following code:

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

How can i make the messagebox's title be the Window Handle to notepad? Is there any effiecient and simple way to do this using c++?

Remy Lebeau
  • 505,946
  • 29
  • 409
  • 696

1 Answers1

4

This:

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);
IInspectable
  • 40,646
  • 8
  • 77
  • 163
selbie
  • 91,215
  • 14
  • 97
  • 163