ホーム › System.AddressBook › HrQueryAllRows
HrQueryAllRows
関数MAPIテーブルから条件に合う全行を一括取得する。
シグネチャ
// MAPI32.dll
#include <windows.h>
HRESULT HrQueryAllRows(
IMAPITable* lpTable,
SPropTagArray* lpPropTags,
SRestriction* lpRestriction,
SSortOrderSet* lpSortOrderSet,
INT crowsMax,
SRowSet** lppRows
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| lpTable | IMAPITable* | in |
| lpPropTags | SPropTagArray* | inout |
| lpRestriction | SRestriction* | inout |
| lpSortOrderSet | SSortOrderSet* | inout |
| crowsMax | INT | in |
| lppRows | SRowSet** | inout |
戻り値の型: HRESULT
各言語での呼び出し定義
// MAPI32.dll
#include <windows.h>
HRESULT HrQueryAllRows(
IMAPITable* lpTable,
SPropTagArray* lpPropTags,
SRestriction* lpRestriction,
SSortOrderSet* lpSortOrderSet,
INT crowsMax,
SRowSet** lppRows
);[DllImport("MAPI32.dll", ExactSpelling = true)]
static extern int HrQueryAllRows(
IntPtr lpTable, // IMAPITable*
IntPtr lpPropTags, // SPropTagArray* in/out
IntPtr lpRestriction, // SRestriction* in/out
IntPtr lpSortOrderSet, // SSortOrderSet* in/out
int crowsMax, // INT
IntPtr lppRows // SRowSet** in/out
);<DllImport("MAPI32.dll", ExactSpelling:=True)>
Public Shared Function HrQueryAllRows(
lpTable As IntPtr, ' IMAPITable*
lpPropTags As IntPtr, ' SPropTagArray* in/out
lpRestriction As IntPtr, ' SRestriction* in/out
lpSortOrderSet As IntPtr, ' SSortOrderSet* in/out
crowsMax As Integer, ' INT
lppRows As IntPtr ' SRowSet** in/out
) As Integer
End Function' lpTable : IMAPITable*
' lpPropTags : SPropTagArray* in/out
' lpRestriction : SRestriction* in/out
' lpSortOrderSet : SSortOrderSet* in/out
' crowsMax : INT
' lppRows : SRowSet** in/out
Declare PtrSafe Function HrQueryAllRows Lib "mapi32" ( _
ByVal lpTable As LongPtr, _
ByVal lpPropTags As LongPtr, _
ByVal lpRestriction As LongPtr, _
ByVal lpSortOrderSet As LongPtr, _
ByVal crowsMax As Long, _
ByVal lppRows As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
HrQueryAllRows = ctypes.windll.mapi32.HrQueryAllRows
HrQueryAllRows.restype = ctypes.c_int
HrQueryAllRows.argtypes = [
ctypes.c_void_p, # lpTable : IMAPITable*
ctypes.c_void_p, # lpPropTags : SPropTagArray* in/out
ctypes.c_void_p, # lpRestriction : SRestriction* in/out
ctypes.c_void_p, # lpSortOrderSet : SSortOrderSet* in/out
ctypes.c_int, # crowsMax : INT
ctypes.c_void_p, # lppRows : SRowSet** in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MAPI32.dll')
HrQueryAllRows = Fiddle::Function.new(
lib['HrQueryAllRows'],
[
Fiddle::TYPE_VOIDP, # lpTable : IMAPITable*
Fiddle::TYPE_VOIDP, # lpPropTags : SPropTagArray* in/out
Fiddle::TYPE_VOIDP, # lpRestriction : SRestriction* in/out
Fiddle::TYPE_VOIDP, # lpSortOrderSet : SSortOrderSet* in/out
Fiddle::TYPE_INT, # crowsMax : INT
Fiddle::TYPE_VOIDP, # lppRows : SRowSet** in/out
],
Fiddle::TYPE_INT)#[link(name = "mapi32")]
extern "system" {
fn HrQueryAllRows(
lpTable: *mut core::ffi::c_void, // IMAPITable*
lpPropTags: *mut SPropTagArray, // SPropTagArray* in/out
lpRestriction: *mut SRestriction, // SRestriction* in/out
lpSortOrderSet: *mut SSortOrderSet, // SSortOrderSet* in/out
crowsMax: i32, // INT
lppRows: *mut *mut SRowSet // SRowSet** in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("MAPI32.dll")]
public static extern int HrQueryAllRows(IntPtr lpTable, IntPtr lpPropTags, IntPtr lpRestriction, IntPtr lpSortOrderSet, int crowsMax, IntPtr lppRows);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MAPI32_HrQueryAllRows' -Namespace Win32 -PassThru
# $api::HrQueryAllRows(lpTable, lpPropTags, lpRestriction, lpSortOrderSet, crowsMax, lppRows)#uselib "MAPI32.dll"
#func global HrQueryAllRows "HrQueryAllRows" sptr, sptr, sptr, sptr, sptr, sptr
; HrQueryAllRows lpTable, varptr(lpPropTags), varptr(lpRestriction), varptr(lpSortOrderSet), crowsMax, varptr(lppRows) ; 戻り値は stat
; lpTable : IMAPITable* -> "sptr"
; lpPropTags : SPropTagArray* in/out -> "sptr"
; lpRestriction : SRestriction* in/out -> "sptr"
; lpSortOrderSet : SSortOrderSet* in/out -> "sptr"
; crowsMax : INT -> "sptr"
; lppRows : SRowSet** in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "MAPI32.dll" #cfunc global HrQueryAllRows "HrQueryAllRows" sptr, var, var, var, int, var ; res = HrQueryAllRows(lpTable, lpPropTags, lpRestriction, lpSortOrderSet, crowsMax, lppRows) ; lpTable : IMAPITable* -> "sptr" ; lpPropTags : SPropTagArray* in/out -> "var" ; lpRestriction : SRestriction* in/out -> "var" ; lpSortOrderSet : SSortOrderSet* in/out -> "var" ; crowsMax : INT -> "int" ; lppRows : SRowSet** in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "MAPI32.dll" #cfunc global HrQueryAllRows "HrQueryAllRows" sptr, sptr, sptr, sptr, int, sptr ; res = HrQueryAllRows(lpTable, varptr(lpPropTags), varptr(lpRestriction), varptr(lpSortOrderSet), crowsMax, varptr(lppRows)) ; lpTable : IMAPITable* -> "sptr" ; lpPropTags : SPropTagArray* in/out -> "sptr" ; lpRestriction : SRestriction* in/out -> "sptr" ; lpSortOrderSet : SSortOrderSet* in/out -> "sptr" ; crowsMax : INT -> "int" ; lppRows : SRowSet** in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT HrQueryAllRows(IMAPITable* lpTable, SPropTagArray* lpPropTags, SRestriction* lpRestriction, SSortOrderSet* lpSortOrderSet, INT crowsMax, SRowSet** lppRows) #uselib "MAPI32.dll" #cfunc global HrQueryAllRows "HrQueryAllRows" intptr, var, var, var, int, var ; res = HrQueryAllRows(lpTable, lpPropTags, lpRestriction, lpSortOrderSet, crowsMax, lppRows) ; lpTable : IMAPITable* -> "intptr" ; lpPropTags : SPropTagArray* in/out -> "var" ; lpRestriction : SRestriction* in/out -> "var" ; lpSortOrderSet : SSortOrderSet* in/out -> "var" ; crowsMax : INT -> "int" ; lppRows : SRowSet** in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT HrQueryAllRows(IMAPITable* lpTable, SPropTagArray* lpPropTags, SRestriction* lpRestriction, SSortOrderSet* lpSortOrderSet, INT crowsMax, SRowSet** lppRows) #uselib "MAPI32.dll" #cfunc global HrQueryAllRows "HrQueryAllRows" intptr, intptr, intptr, intptr, int, intptr ; res = HrQueryAllRows(lpTable, varptr(lpPropTags), varptr(lpRestriction), varptr(lpSortOrderSet), crowsMax, varptr(lppRows)) ; lpTable : IMAPITable* -> "intptr" ; lpPropTags : SPropTagArray* in/out -> "intptr" ; lpRestriction : SRestriction* in/out -> "intptr" ; lpSortOrderSet : SSortOrderSet* in/out -> "intptr" ; crowsMax : INT -> "int" ; lppRows : SRowSet** in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
mapi32 = windows.NewLazySystemDLL("MAPI32.dll")
procHrQueryAllRows = mapi32.NewProc("HrQueryAllRows")
)
// lpTable (IMAPITable*), lpPropTags (SPropTagArray* in/out), lpRestriction (SRestriction* in/out), lpSortOrderSet (SSortOrderSet* in/out), crowsMax (INT), lppRows (SRowSet** in/out)
r1, _, err := procHrQueryAllRows.Call(
uintptr(lpTable),
uintptr(lpPropTags),
uintptr(lpRestriction),
uintptr(lpSortOrderSet),
uintptr(crowsMax),
uintptr(lppRows),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction HrQueryAllRows(
lpTable: Pointer; // IMAPITable*
lpPropTags: Pointer; // SPropTagArray* in/out
lpRestriction: Pointer; // SRestriction* in/out
lpSortOrderSet: Pointer; // SSortOrderSet* in/out
crowsMax: Integer; // INT
lppRows: Pointer // SRowSet** in/out
): Integer; stdcall;
external 'MAPI32.dll' name 'HrQueryAllRows';result := DllCall("MAPI32\HrQueryAllRows"
, "Ptr", lpTable ; IMAPITable*
, "Ptr", lpPropTags ; SPropTagArray* in/out
, "Ptr", lpRestriction ; SRestriction* in/out
, "Ptr", lpSortOrderSet ; SSortOrderSet* in/out
, "Int", crowsMax ; INT
, "Ptr", lppRows ; SRowSet** in/out
, "Int") ; return: HRESULT●HrQueryAllRows(lpTable, lpPropTags, lpRestriction, lpSortOrderSet, crowsMax, lppRows) = DLL("MAPI32.dll", "int HrQueryAllRows(void*, void*, void*, void*, int, void*)")
# 呼び出し: HrQueryAllRows(lpTable, lpPropTags, lpRestriction, lpSortOrderSet, crowsMax, lppRows)
# lpTable : IMAPITable* -> "void*"
# lpPropTags : SPropTagArray* in/out -> "void*"
# lpRestriction : SRestriction* in/out -> "void*"
# lpSortOrderSet : SSortOrderSet* in/out -> "void*"
# crowsMax : INT -> "int"
# lppRows : SRowSet** in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。