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

FPropExists

関数
MAPIオブジェクトに指定プロパティが存在するか判定する。
DLLMAPI32.dll呼出規約winapi

シグネチャ

// MAPI32.dll
#include <windows.h>

BOOL FPropExists(
    IMAPIProp* lpMapiProp,
    DWORD ulPropTag
);

パラメーター

名前方向
lpMapiPropIMAPIProp*in
ulPropTagDWORDin

戻り値の型: BOOL

各言語での呼び出し定義

// MAPI32.dll
#include <windows.h>

BOOL FPropExists(
    IMAPIProp* lpMapiProp,
    DWORD ulPropTag
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("MAPI32.dll", ExactSpelling = true)]
static extern bool FPropExists(
    IntPtr lpMapiProp,   // IMAPIProp*
    uint ulPropTag   // DWORD
);
<DllImport("MAPI32.dll", ExactSpelling:=True)>
Public Shared Function FPropExists(
    lpMapiProp As IntPtr,   ' IMAPIProp*
    ulPropTag As UInteger   ' DWORD
) As Boolean
End Function
' lpMapiProp : IMAPIProp*
' ulPropTag : DWORD
Declare PtrSafe Function FPropExists Lib "mapi32" ( _
    ByVal lpMapiProp As LongPtr, _
    ByVal ulPropTag As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

FPropExists = ctypes.windll.mapi32.FPropExists
FPropExists.restype = wintypes.BOOL
FPropExists.argtypes = [
    ctypes.c_void_p,  # lpMapiProp : IMAPIProp*
    wintypes.DWORD,  # ulPropTag : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MAPI32.dll')
FPropExists = Fiddle::Function.new(
  lib['FPropExists'],
  [
    Fiddle::TYPE_VOIDP,  # lpMapiProp : IMAPIProp*
    -Fiddle::TYPE_INT,  # ulPropTag : DWORD
  ],
  Fiddle::TYPE_INT)
#[link(name = "mapi32")]
extern "system" {
    fn FPropExists(
        lpMapiProp: *mut core::ffi::c_void,  // IMAPIProp*
        ulPropTag: u32  // DWORD
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("MAPI32.dll")]
public static extern bool FPropExists(IntPtr lpMapiProp, uint ulPropTag);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MAPI32_FPropExists' -Namespace Win32 -PassThru
# $api::FPropExists(lpMapiProp, ulPropTag)
#uselib "MAPI32.dll"
#func global FPropExists "FPropExists" sptr, sptr
; FPropExists lpMapiProp, ulPropTag   ; 戻り値は stat
; lpMapiProp : IMAPIProp* -> "sptr"
; ulPropTag : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "MAPI32.dll"
#cfunc global FPropExists "FPropExists" sptr, int
; res = FPropExists(lpMapiProp, ulPropTag)
; lpMapiProp : IMAPIProp* -> "sptr"
; ulPropTag : DWORD -> "int"
; BOOL FPropExists(IMAPIProp* lpMapiProp, DWORD ulPropTag)
#uselib "MAPI32.dll"
#cfunc global FPropExists "FPropExists" intptr, int
; res = FPropExists(lpMapiProp, ulPropTag)
; lpMapiProp : IMAPIProp* -> "intptr"
; ulPropTag : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mapi32 = windows.NewLazySystemDLL("MAPI32.dll")
	procFPropExists = mapi32.NewProc("FPropExists")
)

// lpMapiProp (IMAPIProp*), ulPropTag (DWORD)
r1, _, err := procFPropExists.Call(
	uintptr(lpMapiProp),
	uintptr(ulPropTag),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function FPropExists(
  lpMapiProp: Pointer;   // IMAPIProp*
  ulPropTag: DWORD   // DWORD
): BOOL; stdcall;
  external 'MAPI32.dll' name 'FPropExists';
result := DllCall("MAPI32\FPropExists"
    , "Ptr", lpMapiProp   ; IMAPIProp*
    , "UInt", ulPropTag   ; DWORD
    , "Int")   ; return: BOOL
●FPropExists(lpMapiProp, ulPropTag) = DLL("MAPI32.dll", "bool FPropExists(void*, dword)")
# 呼び出し: FPropExists(lpMapiProp, ulPropTag)
# lpMapiProp : IMAPIProp* -> "void*"
# ulPropTag : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。