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); } }
InfoDlg::InfoDlg(bool Show) { DlgHandle = NULL; UpdateLastMoment(); // $CH <<<>>> these should be elsewhere SnazzyWidgetImageCollection *SWIC = NULL; //char ImagePath[1024]; //osg::ref_ptr<osg::Image> Index; //strcpy(ImagePath, ProgDir); //strcat(ImagePath, "/TempResource/InfoPanelIdx.png"); //Index = osgDB::readImageFile(ImagePath); try { SWIC = new SnazzyWidgetImageCollection(204, 96); // can we get this dynamically somehow? } // try catch(std::bad_alloc) { // $CH <<<>>> These should be done in cleanup too delete SWIC; return; } // catch LoadJPGImageToSnazzyWidgetNormal(IDR_INFOPANEL_NORMAL_JPEG, SWIC); LoadJPGImageToSnazzyWidgetNormalHover(IDR_INFOPANEL_NORMAL_HOVER_JPEG, SWIC); // Selected imagery looks just like Normal, so don't load it, widget will automaticaly use Normal instead //LoadJPGImageToSnazzyWidgetSelected(IDR_INFOPANEL_SEL_JPEG, SWIC); //LoadJPGImageToSnazzyWidgetSelectedHover(IDR_INFOPANEL_SEL_HOVER_JPEG, SWIC); LoadPNGImageToSnazzyWidgetIndex(IDR_INFOPANEL_INDEX_PNG, SWIC); //CopyImageToSnazzyWidgetIndex(Index.get(), SWIC); if(SWC = SWCF->CreateSnazzyWidgetContainer(GetGlobalViewerHWND(), &CallbackObserver, SWIC)) { SWC->CreateSnazzyPushWidget(52, IDCANCEL, LoadStringFromResource(IDS_CLOSETIP)); SWC->CreateSnazzyDragWidget(51, IDC_DRAG, LoadStringFromResource(IDS_DRAGWINTIP)); Text = SWC->CreateSnazzyTextWidget(50, 0, LoadStringFromResource(IDS_INFOTIP)); DlgHandle = SWC->GetContainerNativeWin(); // position window in lower left, just to left of DriveDlg int X, Y; RECT DlgRect, DriveRect; GetWindowRect(DlgHandle, &DlgRect); GetWindowRect(DriveDlg::GetDlgHandle(), &DriveRect); X = (DriveRect.left - (DlgRect.right - DlgRect.left)) - 1; Y = DriveRect.top; SetWindowPos(DlgHandle, NULL, X, Y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); if(GlobalTipSupport) { GlobalTipSupport->AddCallbackWin(DlgHandle); } // if SWC->Show(Show); } // if } // InfoDlg::InfoDlg()