We have to invoke wordApp.quit to quit the whole application.
The following method is from google search, using VC++ to get the existed WORD.EXE instance, to kill it used by the automation method. Of course, whereelse, you can get the WORD.EXE process directly, and call TerminateProcess.
AfxOleInit();//it is very neccessary here. or ::CoInitialize(NULL)/CoUninitialize CLSID clsid; HRESULT hr; hr=::CLSIDFromProgID(L"Word.Application", &clsid); //get the CLSID through ProgID if(FAILED(hr)) ...{ AfxMessageBox(_T("NO OFFICE INSTALLED!")); return; } IUnknown *pUnknown=NULL; IDispatch *pDispatch=NULL; _Application app=NULL; hr=::GetActiveObject(clsid,NULL,&pUnknown); //check whether the instance has existed if(FAILED(hr)) ...{ //AfxMessageBox(_T("No running WORD!")); return; } try ...{ hr=pUnknown->QueryInterface(IID_IDispatch, (LPVOID *)&app); if(FAILED(hr)) throw(_T("Failed to get IDispatchPtr")); pUnknown->Release(); pUnknown=NULL; } catch(LPCTSTR lpErr) ...{ AfxMessageBox(lpErr); } if(pUnknown) pUnknown->Release(); CComVariant SaveChanges(false); // hint save or not CComVariant OriginalFormat, RouteDocument; app.Quit(&SaveChanges, &OriginalFormat, &RouteDocument); app.ReleaseDispatch(); }