GetAddress of IPAddress Control crashing..
-
Hiya I have dropped an IPAddress Control from the toolbox onto my form. But when I use GetAddress() or IsBlank() methods of the IPAddress control, the program crashes with: Debug Assertion Failed! Program: File: f:\vs70builds\3077\vc\MFCATL\ship\atlmfc\include\afxcmn2.inl Line: 344 Does anyone know how to fix this?? Thanks.
-
Hiya I have dropped an IPAddress Control from the toolbox onto my form. But when I use GetAddress() or IsBlank() methods of the IPAddress control, the program crashes with: Debug Assertion Failed! Program: File: f:\vs70builds\3077\vc\MFCATL\ship\atlmfc\include\afxcmn2.inl Line: 344 Does anyone know how to fix this?? Thanks.
-
Hiya I have dropped an IPAddress Control from the toolbox onto my form. But when I use GetAddress() or IsBlank() methods of the IPAddress control, the program crashes with: Debug Assertion Failed! Program: File: f:\vs70builds\3077\vc\MFCATL\ship\atlmfc\include\afxcmn2.inl Line: 344 Does anyone know how to fix this?? Thanks.
Did you try running under the debugger and hitting Retry when prompted? That takes you to the line firing the assertion. Also, look in the
vc7\atlmfc\include
directory under Visual Studio .NET's install directory. The source line reads:_AFXCMN_INLINE BOOL CIPAddressCtrl::IsBlank() const
{ ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, IPM_ISBLANK, 0, 0L); }This indicates that you tried to call it on an object whose
m_hWnd
member isn't a valid window handle. Usually this means that either you tried to use an object you haven't initialised (m_hWnd
isNULL
), that you stored a pointer returned fromGetDlgItem
and then later tried to use that pointer in a different message handler, or, more rarely, that some kind of memory corruption has occurred (typically through a buffer overrun). You'll also get problems passingCWnd
pointers between threads, particularly if they point to temporary objects. You must not store pointers to temporaryCWnd
objects. Any MFC function returning aCWnd*
may return a pointer to a temporary object; these temporary objects are cleaned up the next time your program is idle. If you need to reference a window for a period longer than the duration of the current function, create aCWnd
-derived object and callAttach
. You can use theDDX_Control
function in yourDoDataExchange
override to automatically hook up a member variable to a control. You can do this through the Visual Studio environment by right-clicking the control in the dialog designer and choosing Add Variable. Stability. What an interesting concept. -- Chris Maunder