Creating a CEdit in ATL ActiveX control with MFC Support?
-
I have an ATl ActiveX control I am writing which has support for MFC. I want to add a CEdit in my control so that the user can enter values. How do I create this? I have spent all yesterday (literraly) trying and no luck. I construct by CEdit myEdit; Followed by CWnd* parent = CWnd::FromHandle(this->m_hWnd); myEdit.Create(ES_CENTER | ES_NUMBER | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER, CRect(10, 10, 100, 40), parent, 1); This causes assertion...I cannot even find or understnad where the assertion is caused as when i look at the call stack in the debugger, there are no comments or ASSERT(...) around. Has anybody sucessfully added a CEdit to an ATL ActiveX control which supports MFC? If so...how? Thanks
-
I have an ATl ActiveX control I am writing which has support for MFC. I want to add a CEdit in my control so that the user can enter values. How do I create this? I have spent all yesterday (literraly) trying and no luck. I construct by CEdit myEdit; Followed by CWnd* parent = CWnd::FromHandle(this->m_hWnd); myEdit.Create(ES_CENTER | ES_NUMBER | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER, CRect(10, 10, 100, 40), parent, 1); This causes assertion...I cannot even find or understnad where the assertion is caused as when i look at the call stack in the debugger, there are no comments or ASSERT(...) around. Has anybody sucessfully added a CEdit to an ATL ActiveX control which supports MFC? If so...how? Thanks
Well...finally got this one figured out. Must add [code]AFX_MANAGE_STATE(AfxGetStaticModuleState());[/code] before [code]CWnd* parent = CWnd::FromHandle(this->m_hWnd); myEdit.Create(ES_CENTER | ES_NUMBER | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER, CRect(10, 10, 100, 40), parent, 1);[/code] Ciao ;P
-
Well...finally got this one figured out. Must add [code]AFX_MANAGE_STATE(AfxGetStaticModuleState());[/code] before [code]CWnd* parent = CWnd::FromHandle(this->m_hWnd); myEdit.Create(ES_CENTER | ES_NUMBER | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER, CRect(10, 10, 100, 40), parent, 1);[/code] Ciao ;P