有个额外的话题我需要提醒你 static CWnd* PASCAL FromHandle( HWND hWnd );Returns a pointer to a CWnd object when given a handle to a window. If a CWnd object is not attached to the handle, a temporary CWnd object is created and attached. The pointer may be temporary and should not be stored for later use.请仔细看MSDN,FromHandle返回的CWnd *不要尝试保存,超越一个消息保留的这个对象再次被使用的时候很有可能这个窗口对象已经被删除了。
前面加个(HWND)转换一下就行了CWnd wnd;
wnd.FromHandle(your handle);
ok
HWND hWnd = (HWND)ui;if( IsWindow( hWnd ) )
{
使用CWnd的FromHandle就行了。
}
static CWnd* PASCAL FromHandle( HWND hWnd );Returns a pointer to a CWnd object when given a handle to a window. If a CWnd object is not attached to the handle, a temporary CWnd object is created and attached.
The pointer may be temporary and should not be stored for later use.请仔细看MSDN,FromHandle返回的CWnd *不要尝试保存,超越一个消息保留的这个对象再次被使用的时候很有可能这个窗口对象已经被删除了。