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

LPropCompareProp

関数
二つのプロパティ値を比較し大小関係を整数で返す。
DLLMAPI32.dll呼出規約winapi

シグネチャ

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

INT LPropCompareProp(
    SPropValue* lpSPropValueA,
    SPropValue* lpSPropValueB
);

パラメーター

名前方向
lpSPropValueASPropValue*inout
lpSPropValueBSPropValue*inout

戻り値の型: INT

各言語での呼び出し定義

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

INT LPropCompareProp(
    SPropValue* lpSPropValueA,
    SPropValue* lpSPropValueB
);
[DllImport("MAPI32.dll", ExactSpelling = true)]
static extern int LPropCompareProp(
    IntPtr lpSPropValueA,   // SPropValue* in/out
    IntPtr lpSPropValueB   // SPropValue* in/out
);
<DllImport("MAPI32.dll", ExactSpelling:=True)>
Public Shared Function LPropCompareProp(
    lpSPropValueA As IntPtr,   ' SPropValue* in/out
    lpSPropValueB As IntPtr   ' SPropValue* in/out
) As Integer
End Function
' lpSPropValueA : SPropValue* in/out
' lpSPropValueB : SPropValue* in/out
Declare PtrSafe Function LPropCompareProp Lib "mapi32" ( _
    ByVal lpSPropValueA As LongPtr, _
    ByVal lpSPropValueB As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

LPropCompareProp = ctypes.windll.mapi32.LPropCompareProp
LPropCompareProp.restype = ctypes.c_int
LPropCompareProp.argtypes = [
    ctypes.c_void_p,  # lpSPropValueA : SPropValue* in/out
    ctypes.c_void_p,  # lpSPropValueB : SPropValue* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	mapi32 = windows.NewLazySystemDLL("MAPI32.dll")
	procLPropCompareProp = mapi32.NewProc("LPropCompareProp")
)

// lpSPropValueA (SPropValue* in/out), lpSPropValueB (SPropValue* in/out)
r1, _, err := procLPropCompareProp.Call(
	uintptr(lpSPropValueA),
	uintptr(lpSPropValueB),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function LPropCompareProp(
  lpSPropValueA: Pointer;   // SPropValue* in/out
  lpSPropValueB: Pointer   // SPropValue* in/out
): Integer; stdcall;
  external 'MAPI32.dll' name 'LPropCompareProp';
result := DllCall("MAPI32\LPropCompareProp"
    , "Ptr", lpSPropValueA   ; SPropValue* in/out
    , "Ptr", lpSPropValueB   ; SPropValue* in/out
    , "Int")   ; return: INT
●LPropCompareProp(lpSPropValueA, lpSPropValueB) = DLL("MAPI32.dll", "int LPropCompareProp(void*, void*)")
# 呼び出し: LPropCompareProp(lpSPropValueA, lpSPropValueB)
# lpSPropValueA : SPropValue* in/out -> "void*"
# lpSPropValueB : SPropValue* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。