| 254 | ////////////////////// Create/Init/Destruct Commands /////////////////////// |
| 255 | |
| 256 | BOOL CTxtWinHost::Init(CRichEditUI *re, const CREATESTRUCT *pcs) |
| 257 | { |
| 258 | IUnknown *pUnk; |
| 259 | HRESULT hr; |
| 260 | |
| 261 | m_re = re; |
| 262 | // Initialize Reference count |
| 263 | cRefs = 1; |
| 264 | |
| 265 | // Create and cache CHARFORMAT for this control |
| 266 | if(FAILED(InitDefaultCharFormat(re, &cf, NULL))) |
| 267 | goto err; |
| 268 | |
| 269 | // Create and cache PARAFORMAT for this control |
| 270 | if(FAILED(InitDefaultParaFormat(re, &pf))) |
| 271 | goto err; |
| 272 | |
| 273 | // edit controls created without a window are multiline by default |
| 274 | // so that paragraph formats can be |
| 275 | dwStyle = ES_MULTILINE; |
| 276 | |
| 277 | // edit controls are rich by default |
| 278 | fRich = re->IsRich(); |
| 279 | |
| 280 | cchTextMost = re->GetLimitText(); |
| 281 | |
| 282 | if (pcs ) |
| 283 | { |
| 284 | dwStyle = pcs->style; |
| 285 | |
| 286 | if ( !(dwStyle & (ES_AUTOHSCROLL | WS_HSCROLL)) ) |
| 287 | { |
| 288 | fWordWrap = TRUE; |
| 289 | } |
| 290 | } |
| 291 | |
| 292 | if( !(dwStyle & ES_LEFT) ) |
| 293 | { |
| 294 | if(dwStyle & ES_CENTER) |
| 295 | pf.wAlignment = PFA_CENTER; |
| 296 | else if(dwStyle & ES_RIGHT) |
| 297 | pf.wAlignment = PFA_RIGHT; |
| 298 | } |
| 299 | |
| 300 | fInplaceActive = TRUE; |
| 301 | |
| 302 | // Create Text Services component |
| 303 | //if(FAILED(CreateTextServices(NULL, this, &pUnk))) |
| 304 | // goto err; |
| 305 | |
| 306 | PCreateTextServices TextServicesProc; |
| 307 | HMODULE hmod = LoadLibrary(_T("msftedit.dll")); |
| 308 | if (hmod) |
| 309 | { |
| 310 | TextServicesProc = (PCreateTextServices)GetProcAddress(hmod,"CreateTextServices"); |
| 311 | } |
| 312 | |
| 313 | if (TextServicesProc) |
no test coverage detected