gpt4 book ai didi

winapi - FindWindow 错误 183

转载 作者:行者123 更新时间:2023-12-03 18:26:59 26 4
gpt4 key购买 nike

有谁知道什么会导致 FindWindow 返回错误的函数:

ALREADY_EXISTS error (183)



我能理解 FILE_NOT_FOUND (2) ,但为什么会返回 183 ?

最佳答案

MSDN 说,那 FindWindow FindWindowEx 如果函数失败,则返回 NULL 并且您应该检查 GetLastError .这个文档似乎是错误的。拿这个代码片段:

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

它会输出

00000000 12345



如你所见 FindWindow未能设置最后一个错误。在您的情况下,这意味着 ERROR_ALREADY_EXISTSFindWindow 之前设置的最后一个错误被称为。

关于winapi - FindWindow 错误 183,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6631089/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com