---------------------------
Microsoft Visual C++ Debug Library
---------------------------
Debug Assertion Failed!Program: *********
File: winocc.cpp
Line: 290
For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.(Press Retry to debug the application)
---------------------------
终止(A) 重试(R) 忽略(I)
---------------------------
而Debug是会检测断言的。
除了本身的SetWindowPos,,另外还有好多的按钮,文本框之类的都用,,这些应该不用判断m_hWnd的吧??
而Debug是会检测断言的。
你可以这样用::IsWindow(m_edit.m_hWnd)来判断
if(::IsWindow(m_MainTitle.m_hWnd))
{
m_MainTitle.SetWindowPos(NULL,0,0,cx,37, NULL);
m_MainTitle.RedrawWindow();
}m_MainTitle是CStatic的派生类.
这样应该没错吧..可if条件竟都不能够执行了..这是怎么回事呀??
m_MainTitle.RedrawWindow();冒然执行也会出错
当窗口没有建立时,m_hwnd为NULL,这时如果做某些操作(发消息、移动等),就会触发断言
Microsoft Visual C++ Debug Library
---------------------------
Debug Assertion Failed!Program: D:\work\1mplayer\s1.700(0802291500)\Release\s.exe
File: afxwin1.inl
Line: 22For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.(Press Retry to debug the application)
---------------------------
终止(A) 重试(R) 忽略(I)
---------------------------
---------------------------
Microsoft Visual C++
---------------------------
Unhandled exception in s.exe (MFC42D.DLL): 0xC0000005: Access Violation.
---------------------------
确定
---------------------------