void ShowMessage(int headerId, int bodyId, int footerId, HRESULT hr) { HWND hwndExcel = FindCurrentExcelWindow(); try { CString addInFullPath = AddInFullPath(); CPath addInFileName = addInFullPath; addInFileName.StripPath(); CString msgTitle; msgTitle.FormatMessage(IDS_MSG_TITLE, addInFileName); CString header; header.LoadString(headerId); CString body; body.LoadString(bodyId); CString footer; footer.LoadString(footerId); CString hresult = ""; if (hr != S_OK) { hresult.FormatMessage(IDS_MSG_HRESULT, hr); } CString msg; msg.FormatMessage(IDS_MSG_TEMPLATE, header, body, footer, hresult, addInFullPath); MessageBox(hwndExcel, msg, msgTitle, MB_ICONEXCLAMATION); } catch (...) { ShowMessageError(hwndExcel); } }
//--------------------------------------------------------------------------- bool TfrmClimateAM::Validate() { TEdit *casilla=new TEdit(this); int cod=0; //0 : indica que no hay errores casilla = FindDataError(&cod); if(cod!=0) { ShowMessageError(cod); casilla->SetFocus(); return false; } else { return true; } }
//--------------------------------------------------------------------------- bool TfrmSimulationTime::Validate() { TEdit *box=new TEdit(this); int cod=0; //0 : indica que no hay errores box = FindDataError(&cod); if(cod!=0) { ShowMessageError(cod); box->SetFocus(); return false; } else { return true; } }
void ShowMessage(int headerId, int bodyId, int footerId, HRESULT hr) { if (IsRunningOnCluster()) { // TODO: Consider what to do in cluster context? return; } HWND hwndExcel = FindCurrentExcelWindow(); try { std::wstring addInFullPath = GetAddInFullPath(); std::wstring addInFileName = addInFullPath; StripPath(addInFileName); std::wstring msgTitle = FormatString(LoadStringFromResource(hModuleCurrent, IDS_MSG_TITLE), addInFileName.c_str()); std::wstring header = LoadStringFromResource(hModuleCurrent, headerId); std::wstring body = LoadStringFromResource(hModuleCurrent, bodyId); std::wstring footer = LoadStringFromResource(hModuleCurrent, footerId); std::wstring hresult = L""; if (hr != S_OK) { _com_error error(hr); hresult = FormatString(LoadStringFromResource(hModuleCurrent, IDS_MSG_HRESULT), error.ErrorMessage()); } std::wstring msg = FormatString(LoadStringFromResource(hModuleCurrent, IDS_MSG_TEMPLATE), header.c_str(), body.c_str(), footer.c_str(), hresult.c_str(), addInFullPath.c_str()); MessageBox(hwndExcel, msg.c_str(), msgTitle.c_str(), MB_ICONEXCLAMATION); } catch (...) { ShowMessageError(hwndExcel); } }