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

RoGetAgileReference

関数
オブジェクトへのアジャイル参照を取得する。
DLLOLE32.dll呼出規約winapi対応OSWindows 8.1 以降

シグネチャ

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

HRESULT RoGetAgileReference(
    AgileReferenceOptions options,
    const GUID* riid,
    IUnknown* pUnk,
    IAgileReference** ppAgileReference
);

パラメーター

名前方向
optionsAgileReferenceOptionsin
riidGUID*in
pUnkIUnknown*in
ppAgileReferenceIAgileReference**out

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT RoGetAgileReference(
    AgileReferenceOptions options,
    const GUID* riid,
    IUnknown* pUnk,
    IAgileReference** ppAgileReference
);
[DllImport("OLE32.dll", ExactSpelling = true)]
static extern int RoGetAgileReference(
    int options,   // AgileReferenceOptions
    ref Guid riid,   // GUID*
    IntPtr pUnk,   // IUnknown*
    IntPtr ppAgileReference   // IAgileReference** out
);
<DllImport("OLE32.dll", ExactSpelling:=True)>
Public Shared Function RoGetAgileReference(
    options As Integer,   ' AgileReferenceOptions
    ByRef riid As Guid,   ' GUID*
    pUnk As IntPtr,   ' IUnknown*
    ppAgileReference As IntPtr   ' IAgileReference** out
) As Integer
End Function
' options : AgileReferenceOptions
' riid : GUID*
' pUnk : IUnknown*
' ppAgileReference : IAgileReference** out
Declare PtrSafe Function RoGetAgileReference Lib "ole32" ( _
    ByVal options As Long, _
    ByVal riid As LongPtr, _
    ByVal pUnk As LongPtr, _
    ByVal ppAgileReference As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

RoGetAgileReference = ctypes.windll.ole32.RoGetAgileReference
RoGetAgileReference.restype = ctypes.c_int
RoGetAgileReference.argtypes = [
    ctypes.c_int,  # options : AgileReferenceOptions
    ctypes.c_void_p,  # riid : GUID*
    ctypes.c_void_p,  # pUnk : IUnknown*
    ctypes.c_void_p,  # ppAgileReference : IAgileReference** out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('OLE32.dll')
RoGetAgileReference = Fiddle::Function.new(
  lib['RoGetAgileReference'],
  [
    Fiddle::TYPE_INT,  # options : AgileReferenceOptions
    Fiddle::TYPE_VOIDP,  # riid : GUID*
    Fiddle::TYPE_VOIDP,  # pUnk : IUnknown*
    Fiddle::TYPE_VOIDP,  # ppAgileReference : IAgileReference** out
  ],
  Fiddle::TYPE_INT)
#[link(name = "ole32")]
extern "system" {
    fn RoGetAgileReference(
        options: i32,  // AgileReferenceOptions
        riid: *const GUID,  // GUID*
        pUnk: *mut core::ffi::c_void,  // IUnknown*
        ppAgileReference: *mut *mut core::ffi::c_void  // IAgileReference** out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("OLE32.dll")]
public static extern int RoGetAgileReference(int options, ref Guid riid, IntPtr pUnk, IntPtr ppAgileReference);
"@
$api = Add-Type -MemberDefinition $sig -Name 'OLE32_RoGetAgileReference' -Namespace Win32 -PassThru
# $api::RoGetAgileReference(options, riid, pUnk, ppAgileReference)
#uselib "OLE32.dll"
#func global RoGetAgileReference "RoGetAgileReference" sptr, sptr, sptr, sptr
; RoGetAgileReference options, varptr(riid), pUnk, ppAgileReference   ; 戻り値は stat
; options : AgileReferenceOptions -> "sptr"
; riid : GUID* -> "sptr"
; pUnk : IUnknown* -> "sptr"
; ppAgileReference : IAgileReference** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "OLE32.dll"
#cfunc global RoGetAgileReference "RoGetAgileReference" int, var, sptr, sptr
; res = RoGetAgileReference(options, riid, pUnk, ppAgileReference)
; options : AgileReferenceOptions -> "int"
; riid : GUID* -> "var"
; pUnk : IUnknown* -> "sptr"
; ppAgileReference : IAgileReference** out -> "sptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT RoGetAgileReference(AgileReferenceOptions options, GUID* riid, IUnknown* pUnk, IAgileReference** ppAgileReference)
#uselib "OLE32.dll"
#cfunc global RoGetAgileReference "RoGetAgileReference" int, var, intptr, intptr
; res = RoGetAgileReference(options, riid, pUnk, ppAgileReference)
; options : AgileReferenceOptions -> "int"
; riid : GUID* -> "var"
; pUnk : IUnknown* -> "intptr"
; ppAgileReference : IAgileReference** out -> "intptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	ole32 = windows.NewLazySystemDLL("OLE32.dll")
	procRoGetAgileReference = ole32.NewProc("RoGetAgileReference")
)

// options (AgileReferenceOptions), riid (GUID*), pUnk (IUnknown*), ppAgileReference (IAgileReference** out)
r1, _, err := procRoGetAgileReference.Call(
	uintptr(options),
	uintptr(riid),
	uintptr(pUnk),
	uintptr(ppAgileReference),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function RoGetAgileReference(
  options: Integer;   // AgileReferenceOptions
  riid: PGUID;   // GUID*
  pUnk: Pointer;   // IUnknown*
  ppAgileReference: Pointer   // IAgileReference** out
): Integer; stdcall;
  external 'OLE32.dll' name 'RoGetAgileReference';
result := DllCall("OLE32\RoGetAgileReference"
    , "Int", options   ; AgileReferenceOptions
    , "Ptr", riid   ; GUID*
    , "Ptr", pUnk   ; IUnknown*
    , "Ptr", ppAgileReference   ; IAgileReference** out
    , "Int")   ; return: HRESULT
●RoGetAgileReference(options, riid, pUnk, ppAgileReference) = DLL("OLE32.dll", "int RoGetAgileReference(int, void*, void*, void*)")
# 呼び出し: RoGetAgileReference(options, riid, pUnk, ppAgileReference)
# options : AgileReferenceOptions -> "int"
# riid : GUID* -> "void*"
# pUnk : IUnknown* -> "void*"
# ppAgileReference : IAgileReference** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。