Tags Archives: programing

Add/Remove operation is impossible, the code element ‘Cxxx’ is read only

  When attempting to add a Control Event Handler to a control on a dialog, we are encountering the message: Add/Remove operation is impossible, the code element ‘Cxxx’ is read only. After an hour of trying to solve it my self, a quick Google search turned up the following solutions. Add random charters to the [...]

Dump a CListCtrl

This snippet dumps the content of a CListCtrl in to a file. It also gets the number of columns in the list.   int GetColumnsCount( CListCtrl * list ) {     if( list != NULL )     {         const CHeaderCtrl * pHeaderCtrl = (CHeaderCtrl*) list->GetDlgItem(0);         if( pHeaderCtrl != NULL ) {             return  pHeaderCtrl->GetItemCount() [...]

How to create a menu and submenu on right click in MFC

  void ::OnNMRClickBacnetTree(NMHDR *pNMHDR, LRESULT *pResult) {     CPoint ptScreen;     SendMessage(WM_CONTEXTMENU, (WPARAM) m_hWnd, GetMessagePos() );     if (! GetCursorPos(&ptScreen))     {         return ;     }     // Select an element under the right click     CPoint ptClient(ptScreen);     m_BACnetTree.ScreenToClient(&ptClient);        // Create the right click menu     CMenu rightClickMenu;     rightClickMenu.CreatePopupMenu();     rightClickMenu.AppendMenu(MF_STRING,1021,_T("One")); [...]

NSIS – tips and tricks

I create a lot of windows application to make things easier for my customers. The simple act of coping a file from an email to a certain directory can become the most complicated tasks for a certain type of customer. I use an Scriptable Install System provided by NullSoft called NSIS (Nullsoft Scriptable Install System). [...]