void CFormatMsgDlg::OnOK() { SRichEdit *pEdit = FindChildByName2<SRichEdit>(L"re_xmlinput"); m_strMsg = pEdit->GetWindowText(); SEdit *pRepeat = FindChildByName2<SEdit>(L"edit_repeat"); SStringT strRepeat = pRepeat->GetWindowText(); m_nRepeat = _tstoi(strRepeat); EndDialog(IDOK); }
void CMainDlg::OnBtnInsertGif2RE() { SRichEdit *pEdit = FindChildByName2<SRichEdit>(L"re_gifhost"); if(pEdit) { CFileDialogEx openDlg(TRUE,_T("gif"),0,6,_T("gif files(*.gif)\0*.gif\0All files (*.*)\0*.*\0\0")); if(openDlg.DoModal()==IDOK) { ISmileySource* pSource = new CSmileySource2; HRESULT hr=pSource->LoadFromFile(S_CT2W(openDlg.m_szFileName)); if(SUCCEEDED(hr)) { SComPtr<ISoSmileyCtrl> pSmiley; hr=::CoCreateInstance(SoSmiley::CLSID_CSoSmileyCtrl,NULL,CLSCTX_INPROC,__uuidof(SoSmiley::ISoSmileyCtrl),(LPVOID*)&pSmiley); if(SUCCEEDED(hr)) { pSmiley->SetSource(pSource); SComPtr<IRichEditOle> ole; pEdit->SSendMessage(EM_GETOLEINTERFACE,0,(LPARAM)&ole); pSmiley->Insert2Richedit((DWORD_PTR)(void*)ole); } else { UINT uRet = SMessageBox(m_hWnd,_T("可能是因为没有向系统注册表情COM模块。\\n现在注册吗?"),_T("创建表情OLE对象失败"),MB_YESNO|MB_ICONSTOP); if(uRet == IDYES) { HMODULE hMod = LoadLibrary(_T("sosmiley.dll")); if(hMod) { typedef HRESULT (STDAPICALLTYPE *DllRegisterServerPtr)(); DllRegisterServerPtr funRegDll = (DllRegisterServerPtr)GetProcAddress(hMod,"DllRegisterServer"); if(funRegDll) { HRESULT hr=funRegDll(); if(FAILED(hr)) { SMessageBox(m_hWnd,_T("请使用管理员权限运行模块注册程序"),_T("注册表情COM失败"),MB_OK|MB_ICONSTOP); } else { SMessageBox(m_hWnd,_T("请重试"),_T("注册成功"),MB_OK|MB_ICONINFORMATION); } } FreeLibrary(hMod); } else { SMessageBox(m_hWnd,_T("没有找到表情COM模块[sosmiley.dll]。\\n现在注册吗"),_T("错误"),MB_OK|MB_ICONSTOP); } } } } else { SMessageBox(m_hWnd,_T("加载表情失败"),_T("错误"),MB_OK|MB_ICONSTOP); } pSource->Release(); } } }
LRESULT CMainDlg::OnInitDialog( HWND hWnd, LPARAM lParam ) { m_bLayoutInited=TRUE; InitListCtrl(); InitPumpCheckBox(); SRichEdit *pEdit = FindChildByName2<SRichEdit>(L"re_gifhost"); if(pEdit) { SetSRicheditOleCallback(pEdit,CreateSource2); pEdit->SetAttribute(L"rtf",L"rtf:rtf_test"); } return 0; }
void CFormatMsgDlg::OnOK() { SRichEdit* pEdit = FindChildByName2<SRichEdit>( L"re_xmlinput" ); m_strMsg = pEdit->GetWindowText(); EndDialog( IDOK ); }