ホーム › System.AddressBook › LPropCompareProp
LPropCompareProp
関数二つのプロパティ値を比較し大小関係を整数で返す。
シグネチャ
// MAPI32.dll
#include <windows.h>
INT LPropCompareProp(
SPropValue* lpSPropValueA,
SPropValue* lpSPropValueB
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| lpSPropValueA | SPropValue* | inout | 比較する1つ目のSPropValue構造体へのポインタ。 |
| lpSPropValueB | SPropValue* | inout | 比較する2つ目のSPropValue構造体へのポインタ。大小関係を負/0/正の整数で返す。 |
戻り値の型: 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 方式にも切替可。#uselib "MAPI32.dll" #cfunc global LPropCompareProp "LPropCompareProp" sptr, sptr ; res = LPropCompareProp(varptr(lpSPropValueA), varptr(lpSPropValueB)) ; lpSPropValueA : SPropValue* in/out -> "sptr" ; lpSPropValueB : SPropValue* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは 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 方式にも切替可。; INT LPropCompareProp(SPropValue* lpSPropValueA, SPropValue* lpSPropValueB) #uselib "MAPI32.dll" #cfunc global LPropCompareProp "LPropCompareProp" intptr, intptr ; res = LPropCompareProp(varptr(lpSPropValueA), varptr(lpSPropValueB)) ; lpSPropValueA : SPropValue* in/out -> "intptr" ; lpSPropValueB : SPropValue* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは 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 // INTfunction 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)。const std = @import("std");
extern "mapi32" fn LPropCompareProp(
lpSPropValueA: [*c]SPropValue, // SPropValue* in/out
lpSPropValueB: [*c]SPropValue // SPropValue* in/out
) callconv(std.os.windows.WINAPI) i32;proc LPropCompareProp(
lpSPropValueA: ptr SPropValue, # SPropValue* in/out
lpSPropValueB: ptr SPropValue # SPropValue* in/out
): int32 {.importc: "LPropCompareProp", stdcall, dynlib: "MAPI32.dll".}pragma(lib, "mapi32");
extern(Windows)
int LPropCompareProp(
SPropValue* lpSPropValueA, // SPropValue* in/out
SPropValue* lpSPropValueB // SPropValue* in/out
);ccall((:LPropCompareProp, "MAPI32.dll"), stdcall, Int32,
(Ptr{SPropValue}, Ptr{SPropValue}),
lpSPropValueA, lpSPropValueB)
# lpSPropValueA : SPropValue* in/out -> Ptr{SPropValue}
# lpSPropValueB : SPropValue* in/out -> Ptr{SPropValue}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t LPropCompareProp(
void* lpSPropValueA,
void* lpSPropValueB);
]]
local mapi32 = ffi.load("mapi32")
-- mapi32.LPropCompareProp(lpSPropValueA, lpSPropValueB)
-- lpSPropValueA : SPropValue* in/out
-- lpSPropValueB : SPropValue* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('MAPI32.dll');
const LPropCompareProp = lib.func('__stdcall', 'LPropCompareProp', 'int32_t', ['void *', 'void *']);
// LPropCompareProp(lpSPropValueA, lpSPropValueB)
// lpSPropValueA : SPropValue* in/out -> 'void *'
// lpSPropValueB : SPropValue* in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("MAPI32.dll", {
LPropCompareProp: { parameters: ["pointer", "pointer"], result: "i32" },
});
// lib.symbols.LPropCompareProp(lpSPropValueA, lpSPropValueB)
// lpSPropValueA : SPropValue* in/out -> "pointer"
// lpSPropValueB : SPropValue* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t LPropCompareProp(
void* lpSPropValueA,
void* lpSPropValueB);
C, "MAPI32.dll");
// $ffi->LPropCompareProp(lpSPropValueA, lpSPropValueB);
// lpSPropValueA : SPropValue* in/out
// lpSPropValueB : 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);
int LPropCompareProp(
Pointer lpSPropValueA, // SPropValue* in/out
Pointer lpSPropValueB // SPropValue* in/out
);
}@[Link("mapi32")]
lib LibMAPI32
fun LPropCompareProp = LPropCompareProp(
lpSPropValueA : SPropValue*, # SPropValue* in/out
lpSPropValueB : 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 LPropComparePropNative = Int32 Function(Pointer<Void>, Pointer<Void>);
typedef LPropComparePropDart = int Function(Pointer<Void>, Pointer<Void>);
final LPropCompareProp = DynamicLibrary.open('MAPI32.dll')
.lookupFunction<LPropComparePropNative, LPropComparePropDart>('LPropCompareProp');
// lpSPropValueA : SPropValue* in/out -> Pointer<Void>
// lpSPropValueB : SPropValue* in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function LPropCompareProp(
lpSPropValueA: Pointer; // SPropValue* in/out
lpSPropValueB: Pointer // SPropValue* in/out
): Integer; stdcall;
external 'MAPI32.dll' name 'LPropCompareProp';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "LPropCompareProp"
c_LPropCompareProp :: Ptr () -> Ptr () -> IO Int32
-- lpSPropValueA : SPropValue* in/out -> Ptr ()
-- lpSPropValueB : SPropValue* in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let lpropcompareprop =
foreign "LPropCompareProp"
((ptr void) @-> (ptr void) @-> returning int32_t)
(* lpSPropValueA : SPropValue* in/out -> (ptr void) *)
(* lpSPropValueB : 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 ("LPropCompareProp" lprop-compare-prop :convention :stdcall) :int32
(lp-sprop-value-a :pointer) ; SPropValue* in/out
(lp-sprop-value-b :pointer)) ; SPropValue* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $LPropCompareProp = Win32::API::More->new('MAPI32',
'int LPropCompareProp(LPVOID lpSPropValueA, LPVOID lpSPropValueB)');
# my $ret = $LPropCompareProp->Call($lpSPropValueA, $lpSPropValueB);
# lpSPropValueA : SPropValue* in/out -> LPVOID
# lpSPropValueB : SPropValue* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型