我有代码:
......
g_hWnd = CreateWindow( L"Urok6WindowClass", L"TitleWindow", WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, rc.right - rc.left, rc.bottom - rc.top, NULL, NULL, hInstance,
NULL );
if( !g_hWnd )
return E_FAIL;
ShowWindow(g_hWnd, nCmdShow );
一切正常。但如果我添加:
LPTSTR tilte_old= L"Old title";
int gettus = GetWindowText(g_hWnd, tilte_old, 100);
DWORD error = GetLastError();
WCHAR szTest[10];
swprintf_s(szTest, 10, L"%d", error);
MessageBox(NULL, szTest, L"TEST2", MB_OK);
消息框 >> 1400
获取>>''
为什么会这样?为什么windows句柄无效?