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

UlPropSize

関数
プロパティ値が占めるバイトサイズを計算して返す。
DLLMAPI32.dll呼出規約winapi

シグネチャ

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

DWORD UlPropSize(
    SPropValue* lpSPropValue
);

パラメーター

名前方向説明
lpSPropValueSPropValue*inoutサイズを算出するSPropValue構造体へのポインタ。値部分の必要バイト数を返す。

戻り値の型: DWORD

各言語での呼び出し定義

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

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

UlPropSize = ctypes.windll.mapi32.UlPropSize
UlPropSize.restype = wintypes.DWORD
UlPropSize.argtypes = [
    ctypes.c_void_p,  # lpSPropValue : SPropValue* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	mapi32 = windows.NewLazySystemDLL("MAPI32.dll")
	procUlPropSize = mapi32.NewProc("UlPropSize")
)

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

extern "mapi32" fn UlPropSize(
    lpSPropValue: [*c]SPropValue // SPropValue* in/out
) callconv(std.os.windows.WINAPI) u32;
proc UlPropSize(
    lpSPropValue: ptr SPropValue  # SPropValue* in/out
): uint32 {.importc: "UlPropSize", stdcall, dynlib: "MAPI32.dll".}
pragma(lib, "mapi32");
extern(Windows)
uint UlPropSize(
    SPropValue* lpSPropValue   // SPropValue* in/out
);
ccall((:UlPropSize, "MAPI32.dll"), stdcall, UInt32,
      (Ptr{SPropValue},),
      lpSPropValue)
# lpSPropValue : SPropValue* in/out -> Ptr{SPropValue}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
uint32_t UlPropSize(
    void* lpSPropValue);
]]
local mapi32 = ffi.load("mapi32")
-- mapi32.UlPropSize(lpSPropValue)
-- lpSPropValue : SPropValue* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('MAPI32.dll');
const UlPropSize = lib.func('__stdcall', 'UlPropSize', 'uint32_t', ['void *']);
// UlPropSize(lpSPropValue)
// lpSPropValue : SPropValue* in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("MAPI32.dll", {
  UlPropSize: { parameters: ["pointer"], result: "u32" },
});
// lib.symbols.UlPropSize(lpSPropValue)
// lpSPropValue : SPropValue* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t UlPropSize(
    void* lpSPropValue);
C, "MAPI32.dll");
// $ffi->UlPropSize(lpSPropValue);
// lpSPropValue : 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 UlPropSize(
        Pointer lpSPropValue   // SPropValue* in/out
    );
}
@[Link("mapi32")]
lib LibMAPI32
  fun UlPropSize = UlPropSize(
    lpSPropValue : SPropValue*   # SPropValue* in/out
  ) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

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

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

let ulpropsize =
  foreign "UlPropSize"
    ((ptr void) @-> returning uint32_t)
(* lpSPropValue : 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 ("UlPropSize" ul-prop-size :convention :stdcall) :uint32
  (lp-sprop-value :pointer))   ; SPropValue* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $UlPropSize = Win32::API::More->new('MAPI32',
    'DWORD UlPropSize(LPVOID lpSPropValue)');
# my $ret = $UlPropSize->Call($lpSPropValue);
# lpSPropValue : SPropValue* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型