How to get a working context menu on a dialog bar RichEditCtrl ?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 12 of 12

Thread: How to get a working context menu on a dialog bar RichEditCtrl ?

Threaded View

  1. #1
    Join Date
    May 2002
    Posts
    1,717

    How to get a working context menu on a dialog bar RichEditCtrl ?

    I need to get a simple edit menu popup to work on a CRichEditCtrl window in a dialog bar. (VC 2010). I cannot figure out how to 'subclass' (if that is the correct term to use) the dialog bar text window in order to get the popup menu to work. I have tried to subclass the edit window on initialization of the dialog bar using but this invariably results in an appcrash.

    Code:
    LONG CDialogBar1::OnInitDialog ( UINT wParam, LONG lParam)
    {
    	BOOL bRet = HandleInitDialog(wParam, lParam);
    
    	if (!UpdateData(FALSE))
    	{
    	   TRACE0("Warning: UpdateData failed during dialog init.\n");
    	}
    
    	// TODO: Add extra initialization here
    	//GetDlgItem(IDC_EDIT_QUERY)->SubclassDlgItem(IDC_EDIT_QUERY, m_pRichEditEx);
    	//SubclassDlgItem(IDC_EDIT_QUERY, m_pRichEditEx);
    
    	return bRet;
    
    }
    I do not understand the debug messages generated:

    Unhandled exception at 0x77ad15de in XDbar.exe 0xC015000F: The activation context being deactivated is not the most recently activated one.

    afxcomctl32.h
    AFX_ISOLATIONAWARE_STATICLINK_FUNC(HWND ,CreateWindowExW,(DWORD dwExStyle,LPCWSTR lpClassName,LPCWSTR lpWindowName,DWORD dwStyle,int X,int Y,int nWidth,int nHeight,HWND hWndParent,HMENU hMenu,HINSTANCE hInstance,LPVOID lpParam),(dwExStyle,lpClassName,lpWindowName,dwStyle,X,Y,nWidth,nHeight,hWndParent,hMenu,hInstance,lpParam),NULL)
    I have attached a demo XDBarDemo to illustrate the problem and serve as a basis for discussion.

    Any help greatly appreciated.
    Attached Files Attached Files
    mpliam

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center