Hi all,

I have an app that opens Word docs, parses them, and saves them to text file. Everything works great, except when the Word doc is already opened. Then a popup opens:

File In Use
Do you want to:
Open a Read Only copy
Create a local copy and merge your changes later
Receive notification when the original copy is available

And my app hangs and crashes.

How can I detect a word doc is already opened? Then I just would output an error message, skip opening, and parsing that particular word doc.

Qt Code:
  1. my_app = new QAxObject("Word.Application", this);
  2. QAxObject* my_docs = my_app->querySubObject("Documents");
  3.  
  4. //Open docxFile
  5. QString filename(docxFile);
  6. QVariant confirmconversions(false);
  7. QVariant readonly(false);
  8. QVariant addtorecentfiles(false);
  9. QVariant passworddocument("");
  10. QVariant passwordtemplate("");
  11. QVariant revert(false);
  12.  
  13. QAxObject* doc = my_docs->querySubObject("Open(const QVariant&, const QVariant&,const QVariant&, const QVariant&, const QVariant&, const QVariant&,const QVariant&)", filename, confirmconversions, readonly, addtorecentfiles, passworddocument, passwordtemplate, revert);
  14.  
  15. //Pull out active document object
  16. QAxObject* active_doc = my_app->querySubObject("ActiveDocument");
To copy to clipboard, switch view to plain text mode 


Thanks!