What you are doing is not conversion. You just cast hWnd to a pointer to string. Almost always it will not point to a valid string, producing an undefined behavior when you try to print it as a string.
To do it properly, you should trait hWnd's bit's as integer and print it to some buffer as hex before showing in the message box:
#include <sstream>
#include <cstdint>
#include <iomanip>
//.....
std::wstringstream ss;
ss << std::hex << L"0x" << std::setw(16) << std::setfill(L'0') <<
*reinterpret_cast<uint64_t*>(&hWnd) << std::endl;
MessageBox(nullptr, ss.str().c_str(), L"Hello World!",
MB_ICONINFORMATION | MB_OK | MB_DEFBUTTON1);
Notes:
1) stringstream is a C++-style sprintf. It's str() method returns std::string, so to get a C-style pointer you should call c_str on it.
2) I have no Windows to check what is HWND actually. So please check it's size and use appropriate integer type instead of uint64_t. It's important, as if you use a too wide type, you'll get garbage or even access violation. A better approach is to use an integer type template like one discussed here.
3) Probably, you need std::wstringstream as you are using wide-char version of MessageBox.
4) Decoration. ss << *reinterpret_cast<uint64_t*>(&hWnd) just prints raw hex digits to ss, so to get the right format, you should fine-tune it, setting proper padding and filling character. For example, this will cause all integers to be printed as 16-digit numbers with leading zeros:
ss << std::setw(16) << std::setfill(L'0') ...
where setw and setfill functions are from iomanip header. Also, printing 0x prefix is your job, not stringstream's. Also take a look at std::showbase.