- HWND -> std::wstring
wstring hwnd2ws(HWND hWnd)
{
wchar_t wszHWndView[64] = {};
::wnsprintfW(wszHWndView, _countof(wszHWndView), L"%X", hWnd);
return wszHWndView;
}
- std::wstring -> HWND
HWND ws2hwnd(const wstring& wstr)
{
__int64 i64tmp = __int64(0);
std::wstring wstrWnd = wstr;
if (wstrWnd[0] != L'0' && (wstrWnd[0] != L'x' || wstrWnd[0] != L'X'))
wstrWnd = L"0x" + wstrWnd;
::StrToInt64ExW(wstrWnd.c_str(), STIF_SUPPORT_HEX, &i64tmp);
return (HWND)i64tmp;
}
wstring hwnd2ws(HWND hWnd)
{
wchar_t wszHWndView[64] = {};
::wnsprintfW(wszHWndView, _countof(wszHWndView), L"%X", hWnd);
return wszHWndView;
}
HWND ws2hwnd(const wstring& wstr)
{
__int64 i64tmp = __int64(0);
std::wstring wstrWnd = wstr;
if (wstrWnd[0] != L'0' && (wstrWnd[0] != L'x' || wstrWnd[0] != L'X'))
wstrWnd = L"0x" + wstrWnd;
::StrToInt64ExW(wstrWnd.c_str(), STIF_SUPPORT_HEX, &i64tmp);
return (HWND)i64tmp;
}