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

FPropCompareProp

関数
二つのプロパティ値を指定の関係演算子で比較する。
DLLMAPI32.dll呼出規約winapi

シグネチャ

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

BOOL FPropCompareProp(
    SPropValue* lpSPropValue1,
    DWORD ulRelOp,
    SPropValue* lpSPropValue2
);

パラメーター

名前方向説明
lpSPropValue1SPropValue*inout比較の左辺となるSPropValue構造体へのポインタ。
ulRelOpDWORDin比較演算子を示すDWORD値。等価や大小などのRELOP_*を指定する。
lpSPropValue2SPropValue*inout比較の右辺となるSPropValue構造体へのポインタ。条件成立でTRUEを返す。

戻り値の型: BOOL

各言語での呼び出し定義

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

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

FPropCompareProp = ctypes.windll.mapi32.FPropCompareProp
FPropCompareProp.restype = wintypes.BOOL
FPropCompareProp.argtypes = [
    ctypes.c_void_p,  # lpSPropValue1 : SPropValue* in/out
    wintypes.DWORD,  # ulRelOp : DWORD
    ctypes.c_void_p,  # lpSPropValue2 : SPropValue* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MAPI32.dll')
FPropCompareProp = Fiddle::Function.new(
  lib['FPropCompareProp'],
  [
    Fiddle::TYPE_VOIDP,  # lpSPropValue1 : SPropValue* in/out
    -Fiddle::TYPE_INT,  # ulRelOp : DWORD
    Fiddle::TYPE_VOIDP,  # lpSPropValue2 : SPropValue* in/out
  ],
  Fiddle::TYPE_INT)
#[link(name = "mapi32")]
extern "system" {
    fn FPropCompareProp(
        lpSPropValue1: *mut SPropValue,  // SPropValue* in/out
        ulRelOp: u32,  // DWORD
        lpSPropValue2: *mut SPropValue  // SPropValue* in/out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("MAPI32.dll")]
public static extern bool FPropCompareProp(IntPtr lpSPropValue1, uint ulRelOp, IntPtr lpSPropValue2);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MAPI32_FPropCompareProp' -Namespace Win32 -PassThru
# $api::FPropCompareProp(lpSPropValue1, ulRelOp, lpSPropValue2)
#uselib "MAPI32.dll"
#func global FPropCompareProp "FPropCompareProp" sptr, sptr, sptr
; FPropCompareProp varptr(lpSPropValue1), ulRelOp, varptr(lpSPropValue2)   ; 戻り値は stat
; lpSPropValue1 : SPropValue* in/out -> "sptr"
; ulRelOp : DWORD -> "sptr"
; lpSPropValue2 : SPropValue* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "MAPI32.dll"
#cfunc global FPropCompareProp "FPropCompareProp" var, int, var
; res = FPropCompareProp(lpSPropValue1, ulRelOp, lpSPropValue2)
; lpSPropValue1 : SPropValue* in/out -> "var"
; ulRelOp : DWORD -> "int"
; lpSPropValue2 : SPropValue* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; BOOL FPropCompareProp(SPropValue* lpSPropValue1, DWORD ulRelOp, SPropValue* lpSPropValue2)
#uselib "MAPI32.dll"
#cfunc global FPropCompareProp "FPropCompareProp" var, int, var
; res = FPropCompareProp(lpSPropValue1, ulRelOp, lpSPropValue2)
; lpSPropValue1 : SPropValue* in/out -> "var"
; ulRelOp : DWORD -> "int"
; lpSPropValue2 : SPropValue* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mapi32 = windows.NewLazySystemDLL("MAPI32.dll")
	procFPropCompareProp = mapi32.NewProc("FPropCompareProp")
)

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

extern "mapi32" fn FPropCompareProp(
    lpSPropValue1: [*c]SPropValue, // SPropValue* in/out
    ulRelOp: u32, // DWORD
    lpSPropValue2: [*c]SPropValue // SPropValue* in/out
) callconv(std.os.windows.WINAPI) i32;
proc FPropCompareProp(
    lpSPropValue1: ptr SPropValue,  # SPropValue* in/out
    ulRelOp: uint32,  # DWORD
    lpSPropValue2: ptr SPropValue  # SPropValue* in/out
): int32 {.importc: "FPropCompareProp", stdcall, dynlib: "MAPI32.dll".}
pragma(lib, "mapi32");
extern(Windows)
int FPropCompareProp(
    SPropValue* lpSPropValue1,   // SPropValue* in/out
    uint ulRelOp,   // DWORD
    SPropValue* lpSPropValue2   // SPropValue* in/out
);
ccall((:FPropCompareProp, "MAPI32.dll"), stdcall, Int32,
      (Ptr{SPropValue}, UInt32, Ptr{SPropValue}),
      lpSPropValue1, ulRelOp, lpSPropValue2)
# lpSPropValue1 : SPropValue* in/out -> Ptr{SPropValue}
# ulRelOp : DWORD -> UInt32
# lpSPropValue2 : SPropValue* in/out -> Ptr{SPropValue}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t FPropCompareProp(
    void* lpSPropValue1,
    uint32_t ulRelOp,
    void* lpSPropValue2);
]]
local mapi32 = ffi.load("mapi32")
-- mapi32.FPropCompareProp(lpSPropValue1, ulRelOp, lpSPropValue2)
-- lpSPropValue1 : SPropValue* in/out
-- ulRelOp : DWORD
-- lpSPropValue2 : SPropValue* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('MAPI32.dll');
const FPropCompareProp = lib.func('__stdcall', 'FPropCompareProp', 'int32_t', ['void *', 'uint32_t', 'void *']);
// FPropCompareProp(lpSPropValue1, ulRelOp, lpSPropValue2)
// lpSPropValue1 : SPropValue* in/out -> 'void *'
// ulRelOp : DWORD -> 'uint32_t'
// lpSPropValue2 : SPropValue* in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("MAPI32.dll", {
  FPropCompareProp: { parameters: ["pointer", "u32", "pointer"], result: "i32" },
});
// lib.symbols.FPropCompareProp(lpSPropValue1, ulRelOp, lpSPropValue2)
// lpSPropValue1 : SPropValue* in/out -> "pointer"
// ulRelOp : DWORD -> "u32"
// lpSPropValue2 : SPropValue* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t FPropCompareProp(
    void* lpSPropValue1,
    uint32_t ulRelOp,
    void* lpSPropValue2);
C, "MAPI32.dll");
// $ffi->FPropCompareProp(lpSPropValue1, ulRelOp, lpSPropValue2);
// lpSPropValue1 : SPropValue* in/out
// ulRelOp : DWORD
// lpSPropValue2 : SPropValue* in/out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Mapi32 extends StdCallLibrary {
    Mapi32 INSTANCE = Native.load("mapi32", Mapi32.class);
    boolean FPropCompareProp(
        Pointer lpSPropValue1,   // SPropValue* in/out
        int ulRelOp,   // DWORD
        Pointer lpSPropValue2   // SPropValue* in/out
    );
}
@[Link("mapi32")]
lib LibMAPI32
  fun FPropCompareProp = FPropCompareProp(
    lpSPropValue1 : SPropValue*,   # SPropValue* in/out
    ulRelOp : UInt32,   # DWORD
    lpSPropValue2 : SPropValue*   # SPropValue* in/out
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef FPropComparePropNative = Int32 Function(Pointer<Void>, Uint32, Pointer<Void>);
typedef FPropComparePropDart = int Function(Pointer<Void>, int, Pointer<Void>);
final FPropCompareProp = DynamicLibrary.open('MAPI32.dll')
    .lookupFunction<FPropComparePropNative, FPropComparePropDart>('FPropCompareProp');
// lpSPropValue1 : SPropValue* in/out -> Pointer<Void>
// ulRelOp : DWORD -> Uint32
// lpSPropValue2 : SPropValue* in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function FPropCompareProp(
  lpSPropValue1: Pointer;   // SPropValue* in/out
  ulRelOp: DWORD;   // DWORD
  lpSPropValue2: Pointer   // SPropValue* in/out
): BOOL; stdcall;
  external 'MAPI32.dll' name 'FPropCompareProp';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "FPropCompareProp"
  c_FPropCompareProp :: Ptr () -> Word32 -> Ptr () -> IO CInt
-- lpSPropValue1 : SPropValue* in/out -> Ptr ()
-- ulRelOp : DWORD -> Word32
-- lpSPropValue2 : SPropValue* in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let fpropcompareprop =
  foreign "FPropCompareProp"
    ((ptr void) @-> uint32_t @-> (ptr void) @-> returning int32_t)
(* lpSPropValue1 : SPropValue* in/out -> (ptr void) *)
(* ulRelOp : DWORD -> uint32_t *)
(* lpSPropValue2 : SPropValue* in/out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library mapi32 (t "MAPI32.dll"))
(cffi:use-foreign-library mapi32)

(cffi:defcfun ("FPropCompareProp" fprop-compare-prop :convention :stdcall) :int32
  (lp-sprop-value1 :pointer)   ; SPropValue* in/out
  (ul-rel-op :uint32)   ; DWORD
  (lp-sprop-value2 :pointer))   ; SPropValue* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $FPropCompareProp = Win32::API::More->new('MAPI32',
    'BOOL FPropCompareProp(LPVOID lpSPropValue1, DWORD ulRelOp, LPVOID lpSPropValue2)');
# my $ret = $FPropCompareProp->Call($lpSPropValue1, $ulRelOp, $lpSPropValue2);
# lpSPropValue1 : SPropValue* in/out -> LPVOID
# ulRelOp : DWORD -> DWORD
# lpSPropValue2 : SPropValue* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型