void CMFCPropertyGridPluginProperty::OnClickButton(CPoint /*point*/) { ASSERT_VALID(this); ASSERT_VALID(m_pWndList); ASSERT_VALID(m_pWndInPlace); ASSERT(::IsWindow(m_pWndInPlace->GetSafeHwnd())); m_bButtonIsDown = TRUE; Redraw(); CString strConfig(m_varValue.bstrVal); BOOL bUpdate = FALSE; CString strPluginName = m_pPluginProp->GetValue(); // TODO: Plugin Name CPluginPropDlg dlg(strConfig); if (dlg.DoModal() == IDOK) { bUpdate = TRUE; strConfig = dlg.GetConfig(); } if (bUpdate) { if (m_pWndInPlace != NULL) { m_pWndInPlace->SetWindowText(strConfig); } m_varValue = (LPCTSTR)strConfig; } m_bButtonIsDown = FALSE; Redraw(); if (m_pWndInPlace != NULL) { m_pWndInPlace->SetFocus(); } else { m_pWndList->SetFocus(); } }
void Config::Initialize(const char * path) { struct stat statbuff; int filesize = 0; if(stat(path,&statbuff) < 0) { return; } filesize = statbuff.st_size; int fileno; fileno = open(path,O_RDONLY); if(fileno < 0) { close(fileno); return ; } char * strTemp = new char[filesize]; if(strTemp == NULL) { close(fileno); return; } string strConfig(""); read(fileno,strTemp,filesize); strConfig.append(strTemp); if(strTemp != NULL) { delete [] strTemp; strTemp = NULL; } //LOGDEBUG("debug","filesize = %d,string size = %d",filesize,strConfig.length()); close(fileno); Parse(strConfig); }