开发者

FindWindow error 183

Does anybody know what would cause the FindWindow function to return the error:

ALREADY_EXISTS error (183)

I could understand a FILE_NOT_FOUND (2), but why would it return a 183?开发者_StackOverflow


MSDN says, that FindWindowand FindWindowEx return NULL if the function fails and that you should check GetLastError. It seems that this documentation is wrong. Take this code fragment:

SetLastError(12345);
HWND h = FindWindow(L"class_name_that_does_not_exist", nullptr);
cout << h << ' ' << GetLastError() << endl;

It will output

00000000 12345

So as you can see FindWindow fails to set the last error. In your case this means that the ERROR_ALREADY_EXISTS was the last error set before FindWindow was called.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜