aurel
aurel

Reputation: 1137

What is the meaning of 0x800a1421 HRESULT?

I have a dll written in C++. It's main purpouse is to call methods on Word by OLE. I try to call a method "SaveAs":

HRESULT hr;
szFunction = OLESTR("SaveAs");
    hr = doc->GetIDsOfNames(IID_NULL, &szFunction, 1, 
            LOCALE_USER_DEFAULT, 
            &dispid_Cap);
    hr = doc->Invoke(dispid_Cap, IID_NULL, 
            LOCALE_USER_DEFAULT, DISPATCH_METHOD, 
            &dpCap, NULL, NULL, NULL);

It fails and I can't figure out why. The value of hr is -2146823135. I converted it to hex like this:

sprintf(hex_buff, "%x", (unsigned int)hr);

which gave 0x800a1421

I tried to find out what this code means with this program: http://www.microsoft.com/en-us/download/details.aspx?id=985 But the result was:

as an HRESULT: Severity: FAILURE (1), Facility: 0xa, Code 0x1421
NOT FOUND: 800a1421

What does it mean? How should I proceed to find out why my method fails?

Upvotes: 4

Views: 694

Answers (2)

Hans Passant
Hans Passant

Reputation: 941407

A big reason you are having trouble diagnosing the error is because you took one shortcut too many. You are passing NULL for the IDispatch::Invoke()'s pExcepInfo argument. Which is okay with IDispatch, it basically means "don't bother telling me what you know about the exception, I'll sort it out myself from the error code". You'll miss out on goodies like the textual description of the error and the help file that documents it. If available. Clearly you don't want to take this kind of shortcut when you ask this question.

Anyhoo, you can still reverse-engineer the problem from the exception code. Facility 0x0a are reserved for OLE Automation apps, the error code is specific to the app. Which turns 0x1421 in "Word error 5153". Put that in a Google query, the second hit gives you a link to somebody that has figured out what error 5153 means.

You are trying to overwrite a file that somebody else has opened. Very common mishap.

Fix your code, you'll want to show the error description to a human so they can take care of it.

Upvotes: 5

Smalti
Smalti

Reputation: 507

Info about 0x800a1421 from 'HR Plus' tool:

  • Error Type: OLE HRESULT
  • Error Facility: FACILITY_CONTROL 0x0000000A
  • Severity: SEVERITY_ERROR 0x00000001
  • Code: 0x00001421

And about 0x00001421 from 'Error Lookup' tool: Control ID not found.

Upvotes: 2

Related Questions