更新时间:2023-02-19 22:23:15
The MSDN documentation for GetWindowThreadProcessId has a Community Content section, in which DDeBen has already answered your questions two years before you even asked your question. :)
GetWindowThreadProcessId返回0,并且lpdwProcessId指向变量如果句柄hWnd无效,则不会被修改.GetLastError()返回87(ERROR_INVALID_PARAMETER).
GetWindowThreadProcessId returns 0 and the variable pointed to by lpdwProcessId is not modifed if the handle hWnd is not valid. GetLastError() returns 87 (ERROR_INVALID_PARAMETER).
将来可能需要记住,当不确定不确定的故障状态时, GetLastError()
通常是Win32 API中需要使用的功能.MSDN通常会提供指向它的链接,但是即使不提供链接,将其签出也不会对您造成伤害.但是,请注意,在托管代码中, GetLastError()
需要
In the future it might help to remember that GetLastError()
is often the function you need to go to in the Win32 API when you have failure states you are unsure of. MSDN will generally give a link to it, but even if it does not, it can't hurt to check it out. However, be aware that in managed code GetLastError()
requires special treatment or you will end up with bogus results that will only end up confusing you.