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

UlAddRef

関数
COMオブジェクトの参照カウントを増やす。
DLLMAPI32.dll呼出規約winapi

シグネチャ

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

DWORD UlAddRef(
    void* lpunk
);

パラメーター

名前方向
lpunkvoid*inout

戻り値の型: DWORD

各言語での呼び出し定義

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

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

UlAddRef = ctypes.windll.mapi32.UlAddRef
UlAddRef.restype = wintypes.DWORD
UlAddRef.argtypes = [
    ctypes.POINTER(None),  # lpunk : void* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	mapi32 = windows.NewLazySystemDLL("MAPI32.dll")
	procUlAddRef = mapi32.NewProc("UlAddRef")
)

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