FindWindow error 183

谁都会走 提交于 2019-12-07 07:41:43

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/6631089/findwindow-error-183

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!