Код (Text): void GetTextFromDoc(WCHAR *file,WCHAR *buf,LONG *len){ HRESULT hr; CLSID Word; IDispatch *IDWordApp,*IDWordDocuments,*IDWordDoc,*IDRange; CLSIDFromProgID(WORD_APP,&Word); hr = CoCreateInstance(Word,NULL,CLSCTX_LOCAL_SERVER,IID_IDispatch,(LPVOID*)&IDWordApp); if (FAILED(hr)) return; VARIANT varResult; hr=GetProperty(IDWordApp,OLESTR("Documents"),&varResult); if (FAILED(hr)) return; IDWordDocuments=varResult.pdispVal; DISPPARAMS dp = {0}; dp.cArgs = 1; dp.cNamedArgs = 0; dp.rgvarg = new VARIANT[dp.cArgs]; dp.rgvarg[0].vt = VT_BSTR; dp.rgvarg[0].bstrVal =SysAllocString(file); ZeroMemory(&varResult,sizeof(varResult)); hr=CallMethod(IDWordDocuments,OLESTR("Open"),&dp,&varResult); SysFreeString(dp.rgvarg[0].bstrVal); delete []dp.rgvarg ; IDWordDoc = varResult.pdispVal; if (!FAILED(hr)){ LONG temp; hr=GetProperty(IDWordDoc,OLESTR("Content"),&varResult); IDRange = varResult.pdispVal; hr=GetProperty(IDRange,OLESTR("Text"),&varResult); temp = wcslen(varResult.bstrVal); if (*len > temp){ wcscat(buf,varResult.bstrVal); }; *len = temp; }; dp.cArgs = 0; dp.cNamedArgs = 0; hr=CallMethod(IDWordApp,OLESTR("Quit"),&dp,&varResult); IDRange->Release(); IDWordDoc->Release(); IDWordDocuments->Release(); IDWordApp->Release(); };