N
N Fiorello
I've been pulling my hair out on this one for two days now:
In my (ok, not mine...the one i'm maintaining) service, I'm making the
following series of calls (error checking, and good style abridged for this
post)
#import "msword.olb" raw_interfaces_only \
rename( "ExitWindows", "EW") \
rename("FindText", "FT")
_variant_t vtFileName("c:\\windows\\temp\\WDEADBEEF.doc");
Word::_ApplicationPtr word;
Word:ocumentsPtr documents;
Word::_DocumentPtr document;
hr = word.CreateInstance(__uuidof(Word::Application));
// succeeds
hr = word.get_Documents(&documents);
// succeeds
hr = documents->Open(&vtFileName, // FileName
&vtMissing, // ConfirmConversions
&vtTrue, // ReadOnly
&vtFalse, // AddToRecentFiles
&vtMissing, // PasswordDocument
&vtMissing, // PasswordTemplate
&vtMissing, // Revert
&vtMissing, // WritePasswordDocument
&vtMissing, // WritePasswordTemplate
&vtMissing, // Format
&vtMissing, // Encoding
&vtVisible, // Visible
&vtMissing, // OpenAndRepair
&vtMissing, // DocumentDirection
&vtTrue, // NoEncodingDialog
&vtMissing, // XMLTransform
&document);
if(SUCCEEDED(hr) && !document)
{
// how did I get here? The document opened successfully but I got no
handle?
}
I've tried using both smart and dumb pointers and get the same results.
I can browse to the file, I know it exists, and I can open it manually in
Word just fine.
So is this a bug? What's wrong? How can I put my hair back in?
In my (ok, not mine...the one i'm maintaining) service, I'm making the
following series of calls (error checking, and good style abridged for this
post)
#import "msword.olb" raw_interfaces_only \
rename( "ExitWindows", "EW") \
rename("FindText", "FT")
_variant_t vtFileName("c:\\windows\\temp\\WDEADBEEF.doc");
Word::_ApplicationPtr word;
Word:ocumentsPtr documents;
Word::_DocumentPtr document;
hr = word.CreateInstance(__uuidof(Word::Application));
// succeeds
hr = word.get_Documents(&documents);
// succeeds
hr = documents->Open(&vtFileName, // FileName
&vtMissing, // ConfirmConversions
&vtTrue, // ReadOnly
&vtFalse, // AddToRecentFiles
&vtMissing, // PasswordDocument
&vtMissing, // PasswordTemplate
&vtMissing, // Revert
&vtMissing, // WritePasswordDocument
&vtMissing, // WritePasswordTemplate
&vtMissing, // Format
&vtMissing, // Encoding
&vtVisible, // Visible
&vtMissing, // OpenAndRepair
&vtMissing, // DocumentDirection
&vtTrue, // NoEncodingDialog
&vtMissing, // XMLTransform
&document);
if(SUCCEEDED(hr) && !document)
{
// how did I get here? The document opened successfully but I got no
handle?
}
I've tried using both smart and dumb pointers and get the same results.
I can browse to the file, I know it exists, and I can open it manually in
Word just fine.
So is this a bug? What's wrong? How can I put my hair back in?