Win32 API 日本語リファレンス
ホームSystem.AddressBook › MAPIERROR

MAPIERROR

構造体
サイズx64: 32 バイト / x86: 20 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
ulVersionDWORD4+0+0MAPIERROR構造体のバージョン番号。
lpszErrorCHAR*8/4+8+4エラーの説明文字列へのポインター。文字幅はフラグに依存。
lpszComponentCHAR*8/4+16+8エラーを発生させたコンポーネント名へのポインター。
ulLowLevelErrorDWORD4+24+12下位レベルのエラーコード。
ulContextDWORD4+28+16エラーのコンテキストを示すコンポーネント固有の値。

各言語での定義

#include <windows.h>

// MAPIERROR  (x64 32 / x86 20 バイト)
typedef struct MAPIERROR {
    DWORD ulVersion;
    CHAR* lpszError;
    CHAR* lpszComponent;
    DWORD ulLowLevelError;
    DWORD ulContext;
} MAPIERROR;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MAPIERROR
{
    public uint ulVersion;
    public IntPtr lpszError;
    public IntPtr lpszComponent;
    public uint ulLowLevelError;
    public uint ulContext;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MAPIERROR
    Public ulVersion As UInteger
    Public lpszError As IntPtr
    Public lpszComponent As IntPtr
    Public ulLowLevelError As UInteger
    Public ulContext As UInteger
End Structure
import ctypes
from ctypes import wintypes

class MAPIERROR(ctypes.Structure):
    _fields_ = [
        ("ulVersion", wintypes.DWORD),
        ("lpszError", ctypes.c_void_p),
        ("lpszComponent", ctypes.c_void_p),
        ("ulLowLevelError", wintypes.DWORD),
        ("ulContext", wintypes.DWORD),
    ]
#[repr(C)]
pub struct MAPIERROR {
    pub ulVersion: u32,
    pub lpszError: *mut core::ffi::c_void,
    pub lpszComponent: *mut core::ffi::c_void,
    pub ulLowLevelError: u32,
    pub ulContext: u32,
}
import "golang.org/x/sys/windows"

type MAPIERROR struct {
	ulVersion uint32
	lpszError uintptr
	lpszComponent uintptr
	ulLowLevelError uint32
	ulContext uint32
}
type
  MAPIERROR = record
    ulVersion: DWORD;
    lpszError: Pointer;
    lpszComponent: Pointer;
    ulLowLevelError: DWORD;
    ulContext: DWORD;
  end;
const MAPIERROR = extern struct {
    ulVersion: u32,
    lpszError: ?*anyopaque,
    lpszComponent: ?*anyopaque,
    ulLowLevelError: u32,
    ulContext: u32,
};
type
  MAPIERROR {.bycopy.} = object
    ulVersion: uint32
    lpszError: pointer
    lpszComponent: pointer
    ulLowLevelError: uint32
    ulContext: uint32
struct MAPIERROR
{
    uint ulVersion;
    void* lpszError;
    void* lpszComponent;
    uint ulLowLevelError;
    uint ulContext;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; MAPIERROR サイズ: 20 バイト(x86)
dim st, 5    ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; ulVersion : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; lpszError : CHAR* (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; lpszComponent : CHAR* (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; ulLowLevelError : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; ulContext : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MAPIERROR サイズ: 32 バイト(x64)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; ulVersion : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; lpszError : CHAR* (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; lpszComponent : CHAR* (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; ulLowLevelError : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; ulContext : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global MAPIERROR
    #field int ulVersion
    #field intptr lpszError
    #field intptr lpszComponent
    #field int ulLowLevelError
    #field int ulContext
#endstruct

stdim st, MAPIERROR        ; NSTRUCT 変数を確保
st->ulVersion = 100
mes "ulVersion=" + st->ulVersion