ホーム › System.Ole › OleCreateLink
OleCreateLink
関数モニカで示されるソースへのリンクオブジェクトを作成する。
シグネチャ
// ole32.dll
#include <windows.h>
HRESULT OleCreateLink(
IMoniker* pmkLinkSrc,
const GUID* riid,
DWORD renderopt,
FORMATETC* lpFormatEtc,
IOleClientSite* pClientSite,
IStorage* pStg,
void** ppvObj
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pmkLinkSrc | IMoniker* | in |
| riid | GUID* | in |
| renderopt | DWORD | in |
| lpFormatEtc | FORMATETC* | in |
| pClientSite | IOleClientSite* | in |
| pStg | IStorage* | in |
| ppvObj | void** | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// ole32.dll
#include <windows.h>
HRESULT OleCreateLink(
IMoniker* pmkLinkSrc,
const GUID* riid,
DWORD renderopt,
FORMATETC* lpFormatEtc,
IOleClientSite* pClientSite,
IStorage* pStg,
void** ppvObj
);[DllImport("ole32.dll", ExactSpelling = true)]
static extern int OleCreateLink(
IntPtr pmkLinkSrc, // IMoniker*
ref Guid riid, // GUID*
uint renderopt, // DWORD
IntPtr lpFormatEtc, // FORMATETC*
IntPtr pClientSite, // IOleClientSite*
IntPtr pStg, // IStorage*
IntPtr ppvObj // void** out
);<DllImport("ole32.dll", ExactSpelling:=True)>
Public Shared Function OleCreateLink(
pmkLinkSrc As IntPtr, ' IMoniker*
ByRef riid As Guid, ' GUID*
renderopt As UInteger, ' DWORD
lpFormatEtc As IntPtr, ' FORMATETC*
pClientSite As IntPtr, ' IOleClientSite*
pStg As IntPtr, ' IStorage*
ppvObj As IntPtr ' void** out
) As Integer
End Function' pmkLinkSrc : IMoniker*
' riid : GUID*
' renderopt : DWORD
' lpFormatEtc : FORMATETC*
' pClientSite : IOleClientSite*
' pStg : IStorage*
' ppvObj : void** out
Declare PtrSafe Function OleCreateLink Lib "ole32" ( _
ByVal pmkLinkSrc As LongPtr, _
ByVal riid As LongPtr, _
ByVal renderopt As Long, _
ByVal lpFormatEtc As LongPtr, _
ByVal pClientSite As LongPtr, _
ByVal pStg As LongPtr, _
ByVal ppvObj As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
OleCreateLink = ctypes.windll.ole32.OleCreateLink
OleCreateLink.restype = ctypes.c_int
OleCreateLink.argtypes = [
ctypes.c_void_p, # pmkLinkSrc : IMoniker*
ctypes.c_void_p, # riid : GUID*
wintypes.DWORD, # renderopt : DWORD
ctypes.c_void_p, # lpFormatEtc : FORMATETC*
ctypes.c_void_p, # pClientSite : IOleClientSite*
ctypes.c_void_p, # pStg : IStorage*
ctypes.c_void_p, # ppvObj : void** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('ole32.dll')
OleCreateLink = Fiddle::Function.new(
lib['OleCreateLink'],
[
Fiddle::TYPE_VOIDP, # pmkLinkSrc : IMoniker*
Fiddle::TYPE_VOIDP, # riid : GUID*
-Fiddle::TYPE_INT, # renderopt : DWORD
Fiddle::TYPE_VOIDP, # lpFormatEtc : FORMATETC*
Fiddle::TYPE_VOIDP, # pClientSite : IOleClientSite*
Fiddle::TYPE_VOIDP, # pStg : IStorage*
Fiddle::TYPE_VOIDP, # ppvObj : void** out
],
Fiddle::TYPE_INT)#[link(name = "ole32")]
extern "system" {
fn OleCreateLink(
pmkLinkSrc: *mut core::ffi::c_void, // IMoniker*
riid: *const GUID, // GUID*
renderopt: u32, // DWORD
lpFormatEtc: *mut FORMATETC, // FORMATETC*
pClientSite: *mut core::ffi::c_void, // IOleClientSite*
pStg: *mut core::ffi::c_void, // IStorage*
ppvObj: *mut *mut () // void** out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("ole32.dll")]
public static extern int OleCreateLink(IntPtr pmkLinkSrc, ref Guid riid, uint renderopt, IntPtr lpFormatEtc, IntPtr pClientSite, IntPtr pStg, IntPtr ppvObj);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ole32_OleCreateLink' -Namespace Win32 -PassThru
# $api::OleCreateLink(pmkLinkSrc, riid, renderopt, lpFormatEtc, pClientSite, pStg, ppvObj)#uselib "ole32.dll"
#func global OleCreateLink "OleCreateLink" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; OleCreateLink pmkLinkSrc, varptr(riid), renderopt, varptr(lpFormatEtc), pClientSite, pStg, ppvObj ; 戻り値は stat
; pmkLinkSrc : IMoniker* -> "sptr"
; riid : GUID* -> "sptr"
; renderopt : DWORD -> "sptr"
; lpFormatEtc : FORMATETC* -> "sptr"
; pClientSite : IOleClientSite* -> "sptr"
; pStg : IStorage* -> "sptr"
; ppvObj : void** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "ole32.dll" #cfunc global OleCreateLink "OleCreateLink" sptr, var, int, var, sptr, sptr, sptr ; res = OleCreateLink(pmkLinkSrc, riid, renderopt, lpFormatEtc, pClientSite, pStg, ppvObj) ; pmkLinkSrc : IMoniker* -> "sptr" ; riid : GUID* -> "var" ; renderopt : DWORD -> "int" ; lpFormatEtc : FORMATETC* -> "var" ; pClientSite : IOleClientSite* -> "sptr" ; pStg : IStorage* -> "sptr" ; ppvObj : void** out -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "ole32.dll" #cfunc global OleCreateLink "OleCreateLink" sptr, sptr, int, sptr, sptr, sptr, sptr ; res = OleCreateLink(pmkLinkSrc, varptr(riid), renderopt, varptr(lpFormatEtc), pClientSite, pStg, ppvObj) ; pmkLinkSrc : IMoniker* -> "sptr" ; riid : GUID* -> "sptr" ; renderopt : DWORD -> "int" ; lpFormatEtc : FORMATETC* -> "sptr" ; pClientSite : IOleClientSite* -> "sptr" ; pStg : IStorage* -> "sptr" ; ppvObj : void** out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT OleCreateLink(IMoniker* pmkLinkSrc, GUID* riid, DWORD renderopt, FORMATETC* lpFormatEtc, IOleClientSite* pClientSite, IStorage* pStg, void** ppvObj) #uselib "ole32.dll" #cfunc global OleCreateLink "OleCreateLink" intptr, var, int, var, intptr, intptr, intptr ; res = OleCreateLink(pmkLinkSrc, riid, renderopt, lpFormatEtc, pClientSite, pStg, ppvObj) ; pmkLinkSrc : IMoniker* -> "intptr" ; riid : GUID* -> "var" ; renderopt : DWORD -> "int" ; lpFormatEtc : FORMATETC* -> "var" ; pClientSite : IOleClientSite* -> "intptr" ; pStg : IStorage* -> "intptr" ; ppvObj : void** out -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT OleCreateLink(IMoniker* pmkLinkSrc, GUID* riid, DWORD renderopt, FORMATETC* lpFormatEtc, IOleClientSite* pClientSite, IStorage* pStg, void** ppvObj) #uselib "ole32.dll" #cfunc global OleCreateLink "OleCreateLink" intptr, intptr, int, intptr, intptr, intptr, intptr ; res = OleCreateLink(pmkLinkSrc, varptr(riid), renderopt, varptr(lpFormatEtc), pClientSite, pStg, ppvObj) ; pmkLinkSrc : IMoniker* -> "intptr" ; riid : GUID* -> "intptr" ; renderopt : DWORD -> "int" ; lpFormatEtc : FORMATETC* -> "intptr" ; pClientSite : IOleClientSite* -> "intptr" ; pStg : IStorage* -> "intptr" ; ppvObj : void** out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
ole32 = windows.NewLazySystemDLL("ole32.dll")
procOleCreateLink = ole32.NewProc("OleCreateLink")
)
// pmkLinkSrc (IMoniker*), riid (GUID*), renderopt (DWORD), lpFormatEtc (FORMATETC*), pClientSite (IOleClientSite*), pStg (IStorage*), ppvObj (void** out)
r1, _, err := procOleCreateLink.Call(
uintptr(pmkLinkSrc),
uintptr(riid),
uintptr(renderopt),
uintptr(lpFormatEtc),
uintptr(pClientSite),
uintptr(pStg),
uintptr(ppvObj),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction OleCreateLink(
pmkLinkSrc: Pointer; // IMoniker*
riid: PGUID; // GUID*
renderopt: DWORD; // DWORD
lpFormatEtc: Pointer; // FORMATETC*
pClientSite: Pointer; // IOleClientSite*
pStg: Pointer; // IStorage*
ppvObj: Pointer // void** out
): Integer; stdcall;
external 'ole32.dll' name 'OleCreateLink';result := DllCall("ole32\OleCreateLink"
, "Ptr", pmkLinkSrc ; IMoniker*
, "Ptr", riid ; GUID*
, "UInt", renderopt ; DWORD
, "Ptr", lpFormatEtc ; FORMATETC*
, "Ptr", pClientSite ; IOleClientSite*
, "Ptr", pStg ; IStorage*
, "Ptr", ppvObj ; void** out
, "Int") ; return: HRESULT●OleCreateLink(pmkLinkSrc, riid, renderopt, lpFormatEtc, pClientSite, pStg, ppvObj) = DLL("ole32.dll", "int OleCreateLink(void*, void*, dword, void*, void*, void*, void*)")
# 呼び出し: OleCreateLink(pmkLinkSrc, riid, renderopt, lpFormatEtc, pClientSite, pStg, ppvObj)
# pmkLinkSrc : IMoniker* -> "void*"
# riid : GUID* -> "void*"
# renderopt : DWORD -> "dword"
# lpFormatEtc : FORMATETC* -> "void*"
# pClientSite : IOleClientSite* -> "void*"
# pStg : IStorage* -> "void*"
# ppvObj : void** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。