ホーム › Web.InternetExplorer › DecodeImage
DecodeImage
関数ストリーム内の画像データをMIMEマップに従いデコードする。
シグネチャ
// ImgUtil.dll
#include <windows.h>
HRESULT DecodeImage(
IStream* pStream,
IMapMIMEToCLSID* pMap,
IUnknown* pEventSink
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| pStream | IStream* | in | デコード対象の画像データを供給するIStreamインターフェイスへのポインタを指定する。 |
| pMap | IMapMIMEToCLSID* | in | MIME型からデコーダCLSIDを解決するIMapMIMEToCLSIDへのポインタを指定する。NULL可。 |
| pEventSink | IUnknown* | in | デコード進捗の通知を受け取るイベントシンクのIUnknownへのポインタを指定する。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// ImgUtil.dll
#include <windows.h>
HRESULT DecodeImage(
IStream* pStream,
IMapMIMEToCLSID* pMap,
IUnknown* pEventSink
);[DllImport("ImgUtil.dll", ExactSpelling = true)]
static extern int DecodeImage(
IntPtr pStream, // IStream*
IntPtr pMap, // IMapMIMEToCLSID*
IntPtr pEventSink // IUnknown*
);<DllImport("ImgUtil.dll", ExactSpelling:=True)>
Public Shared Function DecodeImage(
pStream As IntPtr, ' IStream*
pMap As IntPtr, ' IMapMIMEToCLSID*
pEventSink As IntPtr ' IUnknown*
) As Integer
End Function' pStream : IStream*
' pMap : IMapMIMEToCLSID*
' pEventSink : IUnknown*
Declare PtrSafe Function DecodeImage Lib "imgutil" ( _
ByVal pStream As LongPtr, _
ByVal pMap As LongPtr, _
ByVal pEventSink As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DecodeImage = ctypes.windll.imgutil.DecodeImage
DecodeImage.restype = ctypes.c_int
DecodeImage.argtypes = [
ctypes.c_void_p, # pStream : IStream*
ctypes.c_void_p, # pMap : IMapMIMEToCLSID*
ctypes.c_void_p, # pEventSink : IUnknown*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('ImgUtil.dll')
DecodeImage = Fiddle::Function.new(
lib['DecodeImage'],
[
Fiddle::TYPE_VOIDP, # pStream : IStream*
Fiddle::TYPE_VOIDP, # pMap : IMapMIMEToCLSID*
Fiddle::TYPE_VOIDP, # pEventSink : IUnknown*
],
Fiddle::TYPE_INT)#[link(name = "imgutil")]
extern "system" {
fn DecodeImage(
pStream: *mut core::ffi::c_void, // IStream*
pMap: *mut core::ffi::c_void, // IMapMIMEToCLSID*
pEventSink: *mut core::ffi::c_void // IUnknown*
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("ImgUtil.dll")]
public static extern int DecodeImage(IntPtr pStream, IntPtr pMap, IntPtr pEventSink);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ImgUtil_DecodeImage' -Namespace Win32 -PassThru
# $api::DecodeImage(pStream, pMap, pEventSink)#uselib "ImgUtil.dll"
#func global DecodeImage "DecodeImage" sptr, sptr, sptr
; DecodeImage pStream, pMap, pEventSink ; 戻り値は stat
; pStream : IStream* -> "sptr"
; pMap : IMapMIMEToCLSID* -> "sptr"
; pEventSink : IUnknown* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "ImgUtil.dll"
#cfunc global DecodeImage "DecodeImage" sptr, sptr, sptr
; res = DecodeImage(pStream, pMap, pEventSink)
; pStream : IStream* -> "sptr"
; pMap : IMapMIMEToCLSID* -> "sptr"
; pEventSink : IUnknown* -> "sptr"; HRESULT DecodeImage(IStream* pStream, IMapMIMEToCLSID* pMap, IUnknown* pEventSink)
#uselib "ImgUtil.dll"
#cfunc global DecodeImage "DecodeImage" intptr, intptr, intptr
; res = DecodeImage(pStream, pMap, pEventSink)
; pStream : IStream* -> "intptr"
; pMap : IMapMIMEToCLSID* -> "intptr"
; pEventSink : IUnknown* -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
imgutil = windows.NewLazySystemDLL("ImgUtil.dll")
procDecodeImage = imgutil.NewProc("DecodeImage")
)
// pStream (IStream*), pMap (IMapMIMEToCLSID*), pEventSink (IUnknown*)
r1, _, err := procDecodeImage.Call(
uintptr(pStream),
uintptr(pMap),
uintptr(pEventSink),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction DecodeImage(
pStream: Pointer; // IStream*
pMap: Pointer; // IMapMIMEToCLSID*
pEventSink: Pointer // IUnknown*
): Integer; stdcall;
external 'ImgUtil.dll' name 'DecodeImage';result := DllCall("ImgUtil\DecodeImage"
, "Ptr", pStream ; IStream*
, "Ptr", pMap ; IMapMIMEToCLSID*
, "Ptr", pEventSink ; IUnknown*
, "Int") ; return: HRESULT●DecodeImage(pStream, pMap, pEventSink) = DLL("ImgUtil.dll", "int DecodeImage(void*, void*, void*)")
# 呼び出し: DecodeImage(pStream, pMap, pEventSink)
# pStream : IStream* -> "void*"
# pMap : IMapMIMEToCLSID* -> "void*"
# pEventSink : IUnknown* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "imgutil" fn DecodeImage(
pStream: ?*anyopaque, // IStream*
pMap: ?*anyopaque, // IMapMIMEToCLSID*
pEventSink: ?*anyopaque // IUnknown*
) callconv(std.os.windows.WINAPI) i32;proc DecodeImage(
pStream: pointer, # IStream*
pMap: pointer, # IMapMIMEToCLSID*
pEventSink: pointer # IUnknown*
): int32 {.importc: "DecodeImage", stdcall, dynlib: "ImgUtil.dll".}pragma(lib, "imgutil");
extern(Windows)
int DecodeImage(
void* pStream, // IStream*
void* pMap, // IMapMIMEToCLSID*
void* pEventSink // IUnknown*
);ccall((:DecodeImage, "ImgUtil.dll"), stdcall, Int32,
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}),
pStream, pMap, pEventSink)
# pStream : IStream* -> Ptr{Cvoid}
# pMap : IMapMIMEToCLSID* -> Ptr{Cvoid}
# pEventSink : IUnknown* -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t DecodeImage(
void* pStream,
void* pMap,
void* pEventSink);
]]
local imgutil = ffi.load("imgutil")
-- imgutil.DecodeImage(pStream, pMap, pEventSink)
-- pStream : IStream*
-- pMap : IMapMIMEToCLSID*
-- pEventSink : IUnknown*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('ImgUtil.dll');
const DecodeImage = lib.func('__stdcall', 'DecodeImage', 'int32_t', ['void *', 'void *', 'void *']);
// DecodeImage(pStream, pMap, pEventSink)
// pStream : IStream* -> 'void *'
// pMap : IMapMIMEToCLSID* -> 'void *'
// pEventSink : IUnknown* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("ImgUtil.dll", {
DecodeImage: { parameters: ["pointer", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.DecodeImage(pStream, pMap, pEventSink)
// pStream : IStream* -> "pointer"
// pMap : IMapMIMEToCLSID* -> "pointer"
// pEventSink : IUnknown* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t DecodeImage(
void* pStream,
void* pMap,
void* pEventSink);
C, "ImgUtil.dll");
// $ffi->DecodeImage(pStream, pMap, pEventSink);
// pStream : IStream*
// pMap : IMapMIMEToCLSID*
// pEventSink : IUnknown*
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Imgutil extends StdCallLibrary {
Imgutil INSTANCE = Native.load("imgutil", Imgutil.class);
int DecodeImage(
Pointer pStream, // IStream*
Pointer pMap, // IMapMIMEToCLSID*
Pointer pEventSink // IUnknown*
);
}@[Link("imgutil")]
lib LibImgUtil
fun DecodeImage = DecodeImage(
pStream : Void*, # IStream*
pMap : Void*, # IMapMIMEToCLSID*
pEventSink : Void* # IUnknown*
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef DecodeImageNative = Int32 Function(Pointer<Void>, Pointer<Void>, Pointer<Void>);
typedef DecodeImageDart = int Function(Pointer<Void>, Pointer<Void>, Pointer<Void>);
final DecodeImage = DynamicLibrary.open('ImgUtil.dll')
.lookupFunction<DecodeImageNative, DecodeImageDart>('DecodeImage');
// pStream : IStream* -> Pointer<Void>
// pMap : IMapMIMEToCLSID* -> Pointer<Void>
// pEventSink : IUnknown* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function DecodeImage(
pStream: Pointer; // IStream*
pMap: Pointer; // IMapMIMEToCLSID*
pEventSink: Pointer // IUnknown*
): Integer; stdcall;
external 'ImgUtil.dll' name 'DecodeImage';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "DecodeImage"
c_DecodeImage :: Ptr () -> Ptr () -> Ptr () -> IO Int32
-- pStream : IStream* -> Ptr ()
-- pMap : IMapMIMEToCLSID* -> Ptr ()
-- pEventSink : IUnknown* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let decodeimage =
foreign "DecodeImage"
((ptr void) @-> (ptr void) @-> (ptr void) @-> returning int32_t)
(* pStream : IStream* -> (ptr void) *)
(* pMap : IMapMIMEToCLSID* -> (ptr void) *)
(* pEventSink : IUnknown* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library imgutil (t "ImgUtil.dll"))
(cffi:use-foreign-library imgutil)
(cffi:defcfun ("DecodeImage" decode-image :convention :stdcall) :int32
(p-stream :pointer) ; IStream*
(p-map :pointer) ; IMapMIMEToCLSID*
(p-event-sink :pointer)) ; IUnknown*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $DecodeImage = Win32::API::More->new('ImgUtil',
'int DecodeImage(LPVOID pStream, LPVOID pMap, LPVOID pEventSink)');
# my $ret = $DecodeImage->Call($pStream, $pMap, $pEventSink);
# pStream : IStream* -> LPVOID
# pMap : IMapMIMEToCLSID* -> LPVOID
# pEventSink : IUnknown* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
類似 API
- f DecodeImageEx — MIMEタイプ指定付きでストリームの画像をデコードする。