ホーム › System.AddressBook › ScCountNotifications
ScCountNotifications
関数通知配列のシリアライズに必要なバイト数を計算する。
シグネチャ
// MAPI32.dll
#include <windows.h>
INT ScCountNotifications(
INT cNotifications,
NOTIFICATION* lpNotifications,
DWORD* lpcb
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| cNotifications | INT | in |
| lpNotifications | NOTIFICATION* | inout |
| lpcb | DWORD* | inout |
戻り値の型: INT
各言語での呼び出し定義
// MAPI32.dll
#include <windows.h>
INT ScCountNotifications(
INT cNotifications,
NOTIFICATION* lpNotifications,
DWORD* lpcb
);[DllImport("MAPI32.dll", ExactSpelling = true)]
static extern int ScCountNotifications(
int cNotifications, // INT
IntPtr lpNotifications, // NOTIFICATION* in/out
ref uint lpcb // DWORD* in/out
);<DllImport("MAPI32.dll", ExactSpelling:=True)>
Public Shared Function ScCountNotifications(
cNotifications As Integer, ' INT
lpNotifications As IntPtr, ' NOTIFICATION* in/out
ByRef lpcb As UInteger ' DWORD* in/out
) As Integer
End Function' cNotifications : INT
' lpNotifications : NOTIFICATION* in/out
' lpcb : DWORD* in/out
Declare PtrSafe Function ScCountNotifications Lib "mapi32" ( _
ByVal cNotifications As Long, _
ByVal lpNotifications As LongPtr, _
ByRef lpcb As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ScCountNotifications = ctypes.windll.mapi32.ScCountNotifications
ScCountNotifications.restype = ctypes.c_int
ScCountNotifications.argtypes = [
ctypes.c_int, # cNotifications : INT
ctypes.c_void_p, # lpNotifications : NOTIFICATION* in/out
ctypes.POINTER(wintypes.DWORD), # lpcb : DWORD* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MAPI32.dll')
ScCountNotifications = Fiddle::Function.new(
lib['ScCountNotifications'],
[
Fiddle::TYPE_INT, # cNotifications : INT
Fiddle::TYPE_VOIDP, # lpNotifications : NOTIFICATION* in/out
Fiddle::TYPE_VOIDP, # lpcb : DWORD* in/out
],
Fiddle::TYPE_INT)#[link(name = "mapi32")]
extern "system" {
fn ScCountNotifications(
cNotifications: i32, // INT
lpNotifications: *mut NOTIFICATION, // NOTIFICATION* in/out
lpcb: *mut u32 // DWORD* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("MAPI32.dll")]
public static extern int ScCountNotifications(int cNotifications, IntPtr lpNotifications, ref uint lpcb);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MAPI32_ScCountNotifications' -Namespace Win32 -PassThru
# $api::ScCountNotifications(cNotifications, lpNotifications, lpcb)#uselib "MAPI32.dll"
#func global ScCountNotifications "ScCountNotifications" sptr, sptr, sptr
; ScCountNotifications cNotifications, varptr(lpNotifications), varptr(lpcb) ; 戻り値は stat
; cNotifications : INT -> "sptr"
; lpNotifications : NOTIFICATION* in/out -> "sptr"
; lpcb : DWORD* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "MAPI32.dll" #cfunc global ScCountNotifications "ScCountNotifications" int, var, var ; res = ScCountNotifications(cNotifications, lpNotifications, lpcb) ; cNotifications : INT -> "int" ; lpNotifications : NOTIFICATION* in/out -> "var" ; lpcb : DWORD* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "MAPI32.dll" #cfunc global ScCountNotifications "ScCountNotifications" int, sptr, sptr ; res = ScCountNotifications(cNotifications, varptr(lpNotifications), varptr(lpcb)) ; cNotifications : INT -> "int" ; lpNotifications : NOTIFICATION* in/out -> "sptr" ; lpcb : DWORD* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT ScCountNotifications(INT cNotifications, NOTIFICATION* lpNotifications, DWORD* lpcb) #uselib "MAPI32.dll" #cfunc global ScCountNotifications "ScCountNotifications" int, var, var ; res = ScCountNotifications(cNotifications, lpNotifications, lpcb) ; cNotifications : INT -> "int" ; lpNotifications : NOTIFICATION* in/out -> "var" ; lpcb : DWORD* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT ScCountNotifications(INT cNotifications, NOTIFICATION* lpNotifications, DWORD* lpcb) #uselib "MAPI32.dll" #cfunc global ScCountNotifications "ScCountNotifications" int, intptr, intptr ; res = ScCountNotifications(cNotifications, varptr(lpNotifications), varptr(lpcb)) ; cNotifications : INT -> "int" ; lpNotifications : NOTIFICATION* in/out -> "intptr" ; lpcb : DWORD* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
mapi32 = windows.NewLazySystemDLL("MAPI32.dll")
procScCountNotifications = mapi32.NewProc("ScCountNotifications")
)
// cNotifications (INT), lpNotifications (NOTIFICATION* in/out), lpcb (DWORD* in/out)
r1, _, err := procScCountNotifications.Call(
uintptr(cNotifications),
uintptr(lpNotifications),
uintptr(lpcb),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction ScCountNotifications(
cNotifications: Integer; // INT
lpNotifications: Pointer; // NOTIFICATION* in/out
lpcb: Pointer // DWORD* in/out
): Integer; stdcall;
external 'MAPI32.dll' name 'ScCountNotifications';result := DllCall("MAPI32\ScCountNotifications"
, "Int", cNotifications ; INT
, "Ptr", lpNotifications ; NOTIFICATION* in/out
, "Ptr", lpcb ; DWORD* in/out
, "Int") ; return: INT●ScCountNotifications(cNotifications, lpNotifications, lpcb) = DLL("MAPI32.dll", "int ScCountNotifications(int, void*, void*)")
# 呼び出し: ScCountNotifications(cNotifications, lpNotifications, lpcb)
# cNotifications : INT -> "int"
# lpNotifications : NOTIFICATION* in/out -> "void*"
# lpcb : DWORD* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。