CEdit PreSubclassWindow Problem

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi
Do anyone know why in derived class of CEdit with PreSubclassWindow that
uses a SetWindowText while( m_hWnd is valid for both conditions)
it works fine if subclassed with DLG items but if it was created ,it
generated Diveded By Zero Access Violation.
this brief code makes scenario.
thanks in advance.

//Header
class CMyEdit : public CEdit
{
public:
CMyEdit(){}
virtual ~CMyEdit(){}
.....
protected:
virtual void PreSubclassWindow();
};
//Source
void CMyEdit::PreSubclassWindow()
{
SetWindowText("Preset Text");
}

//
class CTestDlg : public CDialog
{
...
CMyEdit m_Edmp;
...
}

BOOL CTestDlg::OnInitDialog()
{
....
m_Edmp.Create(WS_BORDER|WS_VISIBLE|WS_CHILD|ES_AUTOHSCROLL,
CRect(50,400,150,430), this, 9);
....
}




.



Relevant Pages

  • Re: Copy/Paste in CMyEdit that inherits from CEdit
    ... Is CMyEdit changing of the functionality of CEdit? ... > is using the class CMyEdit instead of CEdit for the edit control. ... > The problem is that when I run the program, I can't copy/paste anymore in ...
    (microsoft.public.vc.mfc)
  • Copy/Paste in CMyEdit that inherits from CEdit
    ... I created a new class CMyEdit that inherits from CEdit. ... is using the class CMyEdit instead of CEdit for the edit control. ... What should I do to be able to copy/paste with the keyboard? ...
    (microsoft.public.vc.mfc)
  • Re: Copy/Paste in CMyEdit that inherits from CEdit
    ... >I created a new class CMyEdit that inherits from CEdit. ... >is using the class CMyEdit instead of CEdit for the edit control. ...
    (microsoft.public.vc.mfc)
  • Re: Derived Class at Design Time
    ... I had to derive a class as (class CMyEdit: ... Is there any way to drag this derived edit box at design time as if I ... Well, you should be able to put normal CEdits using the resource editor, then replace in the .cpp and .h the corresponding CEdit occurrences with CMyEdit. ... I've never done a control that you can put in the resource editor's toolbox to drag it from there, but as far as I know, it involves creating an ActiveX control. ...
    (microsoft.public.vc.mfc)
  • class derived from template class
    ... I've got a template class: ... virtual void PreSubclassWindow(); ... B.obj: unresolved external symbol "protected: virtual void __thiscall ...
    (comp.lang.cpp)