July 29th, 2011, 08:06 AM
Problem with MFC and different versions of ms word
Problem with same API with different varsions of ms word.
We are accessing ms word using MFC in our C++ application. Using MFC AppWzizard(dll) and with office11 type library(MS Word 2003), a regular MFC static dll has been created and linked our application.
Using MS word for spellchecking functionality.
I am using CheckSpelling function API of ms word as below for spell check.
Application.CheckSpelling(Word, CustomDictionary, IgnoreUppercase, MainDictionary, CustomDictionary2, CustomDictionary3, CustomDictionary4, CustomDictionary5, CustomDictionary6, CustomDictionary7, CustomDictionary8, CustomDictionary9, CustomDictionary10)
The CustomDictionary represents the name of the .dic file to which the application would refer while checking for spelling and IgnoreUppercase is a flag to ignore the uppercase characters.
In the system having only word 2003 installed, Whenever this API is called sending Custom dictionary as parameter, exception occurs with the message “cannot open the dictionary”. And if the same exe of the application is run on the system having word 2010 installed, this works fine.
If the dll is built using office14 type library(MS Word 2010), this API works with word 2010. However if the same exe is taken to system having 2003, the same problem.
Though the same function API is present in both the versions of ms word with same parameters, the problem occurs with word 2003.
The statement I am using is as below.
bool res = m_word.CheckSpelling((LPCTSTR) text, strFilename, m_vFalse, m_vOpt, m_vOpt, m_vOpt, m_vOpt, m_vOpt, m_vOpt, m_vOpt, m_vOpt, m_vOpt, m_vOpt);
text- has the word for spell check.
strFilename – is COleVariant. COleVariant strFilename ((LPCTSTR) Filename). And Filename is Cstring of the location of Custom dictionary.
m_vFalse - COleVariant((short) FALSE);
m_vOpt = COleVariant((long)DISP_E_PARAMNOTFOUND,VT_ERROR);
If no custom dictionary is sent ( i.e. instead of strFilename, if m_vOpt is sent), the API gives no errors in both the version.
Since the same function API is working in higher version, it must also work in lower version.
Is the problem because of creating MFC regular dll statically? Will it work by creating the dynamic dll?
And also please let me know if any modifications to be made to the parameters for word 2003 from MFC code perspective.
thanks in advancs,
Tags for this Thread
Click Here to Expand Forum to Full Width