ホーム › Web.InternetExplorer › DecodeImageEx
DecodeImageEx
関数MIMEタイプ指定付きでストリームの画像をデコードする。
シグネチャ
// ImgUtil.dll
#include <windows.h>
HRESULT DecodeImageEx(
IStream* pStream,
IMapMIMEToCLSID* pMap,
IUnknown* pEventSink,
LPCWSTR pszMIMETypeParam
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pStream | IStream* | in |
| pMap | IMapMIMEToCLSID* | in |
| pEventSink | IUnknown* | in |
| pszMIMETypeParam | LPCWSTR | in |
戻り値の型: HRESULT
各言語での呼び出し定義
// ImgUtil.dll
#include <windows.h>
HRESULT DecodeImageEx(
IStream* pStream,
IMapMIMEToCLSID* pMap,
IUnknown* pEventSink,
LPCWSTR pszMIMETypeParam
);[DllImport("ImgUtil.dll", ExactSpelling = true)]
static extern int DecodeImageEx(
IntPtr pStream, // IStream*
IntPtr pMap, // IMapMIMEToCLSID*
IntPtr pEventSink, // IUnknown*
[MarshalAs(UnmanagedType.LPWStr)] string pszMIMETypeParam // LPCWSTR
);<DllImport("ImgUtil.dll", ExactSpelling:=True)>
Public Shared Function DecodeImageEx(
pStream As IntPtr, ' IStream*
pMap As IntPtr, ' IMapMIMEToCLSID*
pEventSink As IntPtr, ' IUnknown*
<MarshalAs(UnmanagedType.LPWStr)> pszMIMETypeParam As String ' LPCWSTR
) As Integer
End Function' pStream : IStream*
' pMap : IMapMIMEToCLSID*
' pEventSink : IUnknown*
' pszMIMETypeParam : LPCWSTR
Declare PtrSafe Function DecodeImageEx Lib "imgutil" ( _
ByVal pStream As LongPtr, _
ByVal pMap As LongPtr, _
ByVal pEventSink As LongPtr, _
ByVal pszMIMETypeParam As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DecodeImageEx = ctypes.windll.imgutil.DecodeImageEx
DecodeImageEx.restype = ctypes.c_int
DecodeImageEx.argtypes = [
ctypes.c_void_p, # pStream : IStream*
ctypes.c_void_p, # pMap : IMapMIMEToCLSID*
ctypes.c_void_p, # pEventSink : IUnknown*
wintypes.LPCWSTR, # pszMIMETypeParam : LPCWSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('ImgUtil.dll')
DecodeImageEx = Fiddle::Function.new(
lib['DecodeImageEx'],
[
Fiddle::TYPE_VOIDP, # pStream : IStream*
Fiddle::TYPE_VOIDP, # pMap : IMapMIMEToCLSID*
Fiddle::TYPE_VOIDP, # pEventSink : IUnknown*
Fiddle::TYPE_VOIDP, # pszMIMETypeParam : LPCWSTR
],
Fiddle::TYPE_INT)#[link(name = "imgutil")]
extern "system" {
fn DecodeImageEx(
pStream: *mut core::ffi::c_void, // IStream*
pMap: *mut core::ffi::c_void, // IMapMIMEToCLSID*
pEventSink: *mut core::ffi::c_void, // IUnknown*
pszMIMETypeParam: *const u16 // LPCWSTR
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("ImgUtil.dll")]
public static extern int DecodeImageEx(IntPtr pStream, IntPtr pMap, IntPtr pEventSink, [MarshalAs(UnmanagedType.LPWStr)] string pszMIMETypeParam);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ImgUtil_DecodeImageEx' -Namespace Win32 -PassThru
# $api::DecodeImageEx(pStream, pMap, pEventSink, pszMIMETypeParam)#uselib "ImgUtil.dll"
#func global DecodeImageEx "DecodeImageEx" sptr, sptr, sptr, sptr
; DecodeImageEx pStream, pMap, pEventSink, pszMIMETypeParam ; 戻り値は stat
; pStream : IStream* -> "sptr"
; pMap : IMapMIMEToCLSID* -> "sptr"
; pEventSink : IUnknown* -> "sptr"
; pszMIMETypeParam : LPCWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "ImgUtil.dll"
#cfunc global DecodeImageEx "DecodeImageEx" sptr, sptr, sptr, wstr
; res = DecodeImageEx(pStream, pMap, pEventSink, pszMIMETypeParam)
; pStream : IStream* -> "sptr"
; pMap : IMapMIMEToCLSID* -> "sptr"
; pEventSink : IUnknown* -> "sptr"
; pszMIMETypeParam : LPCWSTR -> "wstr"; HRESULT DecodeImageEx(IStream* pStream, IMapMIMEToCLSID* pMap, IUnknown* pEventSink, LPCWSTR pszMIMETypeParam)
#uselib "ImgUtil.dll"
#cfunc global DecodeImageEx "DecodeImageEx" intptr, intptr, intptr, wstr
; res = DecodeImageEx(pStream, pMap, pEventSink, pszMIMETypeParam)
; pStream : IStream* -> "intptr"
; pMap : IMapMIMEToCLSID* -> "intptr"
; pEventSink : IUnknown* -> "intptr"
; pszMIMETypeParam : LPCWSTR -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
imgutil = windows.NewLazySystemDLL("ImgUtil.dll")
procDecodeImageEx = imgutil.NewProc("DecodeImageEx")
)
// pStream (IStream*), pMap (IMapMIMEToCLSID*), pEventSink (IUnknown*), pszMIMETypeParam (LPCWSTR)
r1, _, err := procDecodeImageEx.Call(
uintptr(pStream),
uintptr(pMap),
uintptr(pEventSink),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszMIMETypeParam))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction DecodeImageEx(
pStream: Pointer; // IStream*
pMap: Pointer; // IMapMIMEToCLSID*
pEventSink: Pointer; // IUnknown*
pszMIMETypeParam: PWideChar // LPCWSTR
): Integer; stdcall;
external 'ImgUtil.dll' name 'DecodeImageEx';result := DllCall("ImgUtil\DecodeImageEx"
, "Ptr", pStream ; IStream*
, "Ptr", pMap ; IMapMIMEToCLSID*
, "Ptr", pEventSink ; IUnknown*
, "WStr", pszMIMETypeParam ; LPCWSTR
, "Int") ; return: HRESULT●DecodeImageEx(pStream, pMap, pEventSink, pszMIMETypeParam) = DLL("ImgUtil.dll", "int DecodeImageEx(void*, void*, void*, char*)")
# 呼び出し: DecodeImageEx(pStream, pMap, pEventSink, pszMIMETypeParam)
# pStream : IStream* -> "void*"
# pMap : IMapMIMEToCLSID* -> "void*"
# pEventSink : IUnknown* -> "void*"
# pszMIMETypeParam : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。