Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在我的应用程序中,我通过以下语句获取桌面窗口句柄: HWND hDeskTopWnd = :: GetDesktopWindow();
是否需要对 hDeskTopWnd 进行空值检查。只要桌面存在,桌面窗口在任何情况下都会为空。请澄清。
根据MSDN,没有关于 NULL 返回值的描述。但是,为了以防万一,进行检查也没有坏处(可能还有很多好处)。它花费很少,可能会节省很多。