Wednesday, 15 January 2014

c++ - Meaning of a numerical ErrorMessage -


I'm trying to interface with an OEM library. Everything has worked on a computer, but I am getting lots of problems on any other computer.

I code is throwing a COM exception, but I do not exclude that may not understand the meaning of an error code Error ();

Code

  #include "stdafx.h" # Include & lt; Afx.h & gt; # Include & lt; Iostream & gt; using namespace std; #import "MTBApi.tlb" name_guids // raw_interfaces_only using namespace MTBApi; Zero performance error (_com_error * e) {CString message; // if this. Was thrown by NET is an application error (E & gt; error () & gt; = 0x80041000) {IErrorInfo * info; BSTR messages; Info = e-> ErrorInfo (); Info-> GetDescription (& amp; msg); Info-> Release (); Message = CString (msg); } // Other Com Errors Other {message = e- & gt; Error message (); } Cout & lt; & Lt; "MTB error:" & lt; & Lt; Message & lt; & Lt; ":" & Lt; & Lt; (Unsigned integer) e- & gt; Error () & lt; & Lt; Endl; } Integer main (int argc, char ** argv) {for (int i = 0; i & lt; 4; i ++) {IMTBConnectionPtr m_MTBConnection; {Cout & lt; & Lt; "1" & lt; & Lt; Endl; HRESULT A = Coencientialise X (NULL, COINIT_SPEED_OVER_MEMORY); Cout & lt; & Lt; "2" & lt; & Lt; Endl; M_MTBConnection = IMTBConnectionPtr (CLSID_MTBConnection); Cout & lt; & Lt; "3" & lt; & Lt; Endl; M_MTBConnection-> Close (); Cout & lt; & Lt; "4" & lt; & Lt; Endl; CoUninitialize (); Cout & lt; & Lt; "5" & lt; & Lt; Endl; } Hold (_com_error E) {display error (& amp; A); } Cout & lt; & Lt; Endl; }}   

order to produce

  1 2 MTB error: 00000000002205F8: 2147746132 1 2 MTB error: 00000000002205F8: 2147746132 1 2 MTB error: 00000000002205F8: +2147746132 1 2 MTB error: 00000000002205F8: +2147746132   

reliance Walker rather verbose output

  cout & lt; & Lt; "MTB error:" & lt; & Lt; Message & lt; & Lt; ":" & Lt; & Lt; (Unsigned integer) e- & gt; Error () & lt; & Lt; Endl;   

is not good enough to appear in court Unicode strings, it only displays the string pointer value. Definitely not useful, use the wcout instead of the 0x80040154 in the favor of displaying the error code in hex is a common COM error, the "class is not registered" . Thousands of questions about it already require you to register the com server properly. Ask the seller or author how to do this.

No comments:

Post a Comment