comexception.java

来自「java 调用windows的api」· Java 代码 · 共 39 行

JAVA
39
字号
//******************************************************************
// Released under the DevelopMentor OpenSource Software License.
// Please consult the LICENSE file in the project root directory,
// or at http://www.develop.com for details before using this
// software.
//******************************************************************

package org.jawin;

public class COMException extends Exception {
  public final int hresult;
  public static final int E_UNEXPECTED = 0x8000ffff;
  public COMException() {
    this(E_UNEXPECTED);
  }
  public COMException(int hresult) {
    //COMEBACK and get error string
    this.hresult = hresult;
  }
  public COMException(int hresult, String text) {
    super(text);
    this.hresult = hresult;
  }
  public COMException(int hresult, String desc, String source, String guid) {
    super (desc + "[src=" + source + ",guid=" + guid+ "]");
    this.hresult = hresult;
  }
  public COMException(String text) {
    this(E_UNEXPECTED, text);
  }
  public String getMessage() {
    return Integer.toHexString(hresult) + ": " 
           + super.getMessage();
  }
  public COMException(Throwable t) {
    this(E_UNEXPECTED, t.getMessage());
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?