我用IsWindow函数来判断一个窗口是否存在,今天仔细阅读MSDN上的解释,对里面的一段话不理解,希望有人给我通一下:
Res
An application should not use IsWindow for a window that it did not create because the window could be destroyed after this function was called. Further, because window handles are recycled the handle could even point to a different window. 这是什么意思呢?是不是IsWindow一般不能乱用?
Res
An application should not use IsWindow for a window that it did not create because the window could be destroyed after this function was called. Further, because window handles are recycled the handle could even point to a different window. 这是什么意思呢?是不是IsWindow一般不能乱用?
IsWindow
The IsWindow function determines whether the specified window handle identifies an existing window. BOOL IsWindow(
HWND hWnd // handle to window
);
Parameters
hWnd
[in] Handle to the window to test.
Return Values
If the window handle identifies an existing window, the return value is nonzero.If the window handle does not identify an existing window, the return value is zero. Res
An application should not use IsWindow for a window that it did not create because the window could be destroyed after this function was called. Further, because window handles are recycled the handle could even point to a different window.
if(m_MyDialog.GetSafeHwnd()==NULL)
m_MyDialog.Create(/*具体参数我就不写了*/);
m_MyDialog.ShowWindow(SW_SHOW);
判断当前指针为什么类,可以用GetRuntimeClass();