-
August 26th, 2003, 02:12 PM
#1
Create problem
Hi, I use a class derived from CEdit to implement some kind of combo: edit box and buddy spinner with some special function. When I try to "Create" it, some times it works and some times I get an assertion failure but I don't know why since the same code is used every time. In my class, I have a function to create it which execute the following creation line:
this->Create(WS_CHILD | WS_BORDER | WS_VISIBLE | WS_TABSTOP ,EditBoxRectangle,Parent,IDC_SPINEDITNUMCTRL_EDIT_BOX);
I have no ides about what could cause an assertion failure. Every time it is called, the parrent is always the same. The ID is always the same too but since messages are handled in this class and not in the parent, I suppose this is not the problem. I checked the rectangle and it is valid.
If it can help, has I said before, the program doesn't crash every time this line executes but it always crash on the same call.
Thank you.
-
August 26th, 2003, 02:17 PM
#2
Can u provide the ASSERT information? At what statement its asserting.
Check the Parent value it might be different each time.
Vinod
-
August 26th, 2003, 02:31 PM
#3
Originally posted by vinodp
Can u provide the ASSERT information? At what statement its asserting.
Check the Parent value it might be different each time.
Vinod
I think the assertion information you want are the following:
FILE: WINCORE.CPP
LINE: 628
Here is the function:
void AFXAPI AfxHookWindowCreate(CWnd* pWnd)
{
_AFX_THREAD_STATE* pThreadState = _afxThreadState.GetData();
if (pThreadState->m_pWndInit == pWnd)
return;
if (pThreadState->m_hHookOldCbtFilter == NULL)
{
pThreadState->m_hHookOldCbtFilter = ::SetWindowsHookEx(WH_CBT,
_AfxCbtFilterHook, NULL, ::GetCurrentThreadId());
if (pThreadState->m_hHookOldCbtFilter == NULL)
AfxThrowMemoryException();
}
ASSERT(pThreadState->m_hHookOldCbtFilter != NULL);
ASSERT(pWnd != NULL);
ASSERT(pWnd->m_hWnd == NULL); // only do once
ASSERT(pThreadState->m_pWndInit == NULL); // hook not already in progress
pThreadState->m_pWndInit = pWnd;
}
The assert that fails is :
ASSERT(pWnd->m_hWnd == NULL); // only do once
but I have no idea about what this function is supposed to do, nor what this assert is checking.
For your second question about the parent, I traced the code and I know (I have checked) the parent is always the same. It is quite logic since all the controls are in the same dialog.
Thank you.
-
August 26th, 2003, 03:04 PM
#4
Hi, I've understood what the message was meaning and at the same time what my mistake was. I was creating twice the same window (stupid cut and paste error). I had forgot to change the name between two creation ant the second was trying to create the first again.
Thank you for your help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|