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