Win32 API 日本語リファレンス
ホームMedia.Multimedia › ICGetDisplayFormat

ICGetDisplayFormat

関数
表示に適した映像出力形式を取得する。
DLLMSVFW32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

HIC ICGetDisplayFormat(
    HIC hic,   // optional
    BITMAPINFOHEADER* lpbiIn,
    BITMAPINFOHEADER* lpbiOut,
    INT BitDepth,
    INT dx,
    INT dy
);

パラメーター

名前方向説明
hicHICinoptional使用する圧縮器へのハンドル。VCM に適切な圧縮器を選択して開かせるには NULL を指定します。
lpbiInBITMAPINFOHEADER*in圧縮形式を格納した BITMAPINFOHEADER 構造体へのポインター。
lpbiOutBITMAPINFOHEADER*out展開後の形式を返すためのバッファーへのポインター。バッファーは BITMAPINFOHEADER 構造体と 256 個のカラーエントリを格納できる十分な大きさが必要です。
BitDepthINTin0 以外の場合、優先するビット深度。
dxINTin画像を引き伸ばす幅の倍率。このパラメーターが 0 の場合、その次元は引き伸ばされません。
dyINTin画像を引き伸ばす高さの倍率。このパラメーターが 0 の場合、その次元は引き伸ばされません。

戻り値の型: HIC

公式ドキュメント

ICGetDisplayFormat 関数は、圧縮された画像を表示するために利用可能な最適な形式を判別します。開いている圧縮ハンドルが指定されていない場合、この関数は圧縮器も開きます。

戻り値

成功した場合は展開器へのハンドルを返し、それ以外の場合は 0 を返します。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での呼び出し定義

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

HIC ICGetDisplayFormat(
    HIC hic,   // optional
    BITMAPINFOHEADER* lpbiIn,
    BITMAPINFOHEADER* lpbiOut,
    INT BitDepth,
    INT dx,
    INT dy
);
[DllImport("MSVFW32.dll", ExactSpelling = true)]
static extern IntPtr ICGetDisplayFormat(
    IntPtr hic,   // HIC optional
    IntPtr lpbiIn,   // BITMAPINFOHEADER*
    IntPtr lpbiOut,   // BITMAPINFOHEADER* out
    int BitDepth,   // INT
    int dx,   // INT
    int dy   // INT
);
<DllImport("MSVFW32.dll", ExactSpelling:=True)>
Public Shared Function ICGetDisplayFormat(
    hic As IntPtr,   ' HIC optional
    lpbiIn As IntPtr,   ' BITMAPINFOHEADER*
    lpbiOut As IntPtr,   ' BITMAPINFOHEADER* out
    BitDepth As Integer,   ' INT
    dx As Integer,   ' INT
    dy As Integer   ' INT
) As IntPtr
End Function
' hic : HIC optional
' lpbiIn : BITMAPINFOHEADER*
' lpbiOut : BITMAPINFOHEADER* out
' BitDepth : INT
' dx : INT
' dy : INT
Declare PtrSafe Function ICGetDisplayFormat Lib "msvfw32" ( _
    ByVal hic As LongPtr, _
    ByVal lpbiIn As LongPtr, _
    ByVal lpbiOut As LongPtr, _
    ByVal BitDepth As Long, _
    ByVal dx As Long, _
    ByVal dy As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ICGetDisplayFormat = ctypes.windll.msvfw32.ICGetDisplayFormat
ICGetDisplayFormat.restype = ctypes.c_void_p
ICGetDisplayFormat.argtypes = [
    wintypes.HANDLE,  # hic : HIC optional
    ctypes.c_void_p,  # lpbiIn : BITMAPINFOHEADER*
    ctypes.c_void_p,  # lpbiOut : BITMAPINFOHEADER* out
    ctypes.c_int,  # BitDepth : INT
    ctypes.c_int,  # dx : INT
    ctypes.c_int,  # dy : INT
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MSVFW32.dll')
ICGetDisplayFormat = Fiddle::Function.new(
  lib['ICGetDisplayFormat'],
  [
    Fiddle::TYPE_VOIDP,  # hic : HIC optional
    Fiddle::TYPE_VOIDP,  # lpbiIn : BITMAPINFOHEADER*
    Fiddle::TYPE_VOIDP,  # lpbiOut : BITMAPINFOHEADER* out
    Fiddle::TYPE_INT,  # BitDepth : INT
    Fiddle::TYPE_INT,  # dx : INT
    Fiddle::TYPE_INT,  # dy : INT
  ],
  Fiddle::TYPE_VOIDP)
#[link(name = "msvfw32")]
extern "system" {
    fn ICGetDisplayFormat(
        hic: *mut core::ffi::c_void,  // HIC optional
        lpbiIn: *mut BITMAPINFOHEADER,  // BITMAPINFOHEADER*
        lpbiOut: *mut BITMAPINFOHEADER,  // BITMAPINFOHEADER* out
        BitDepth: i32,  // INT
        dx: i32,  // INT
        dy: i32  // INT
    ) -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("MSVFW32.dll")]
public static extern IntPtr ICGetDisplayFormat(IntPtr hic, IntPtr lpbiIn, IntPtr lpbiOut, int BitDepth, int dx, int dy);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MSVFW32_ICGetDisplayFormat' -Namespace Win32 -PassThru
# $api::ICGetDisplayFormat(hic, lpbiIn, lpbiOut, BitDepth, dx, dy)
#uselib "MSVFW32.dll"
#func global ICGetDisplayFormat "ICGetDisplayFormat" sptr, sptr, sptr, sptr, sptr, sptr
; ICGetDisplayFormat hic, varptr(lpbiIn), varptr(lpbiOut), BitDepth, dx, dy   ; 戻り値は stat
; hic : HIC optional -> "sptr"
; lpbiIn : BITMAPINFOHEADER* -> "sptr"
; lpbiOut : BITMAPINFOHEADER* out -> "sptr"
; BitDepth : INT -> "sptr"
; dx : INT -> "sptr"
; dy : INT -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "MSVFW32.dll"
#cfunc global ICGetDisplayFormat "ICGetDisplayFormat" sptr, var, var, int, int, int
; res = ICGetDisplayFormat(hic, lpbiIn, lpbiOut, BitDepth, dx, dy)
; hic : HIC optional -> "sptr"
; lpbiIn : BITMAPINFOHEADER* -> "var"
; lpbiOut : BITMAPINFOHEADER* out -> "var"
; BitDepth : INT -> "int"
; dx : INT -> "int"
; dy : INT -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HIC ICGetDisplayFormat(HIC hic, BITMAPINFOHEADER* lpbiIn, BITMAPINFOHEADER* lpbiOut, INT BitDepth, INT dx, INT dy)
#uselib "MSVFW32.dll"
#cfunc global ICGetDisplayFormat "ICGetDisplayFormat" intptr, var, var, int, int, int
; res = ICGetDisplayFormat(hic, lpbiIn, lpbiOut, BitDepth, dx, dy)
; hic : HIC optional -> "intptr"
; lpbiIn : BITMAPINFOHEADER* -> "var"
; lpbiOut : BITMAPINFOHEADER* out -> "var"
; BitDepth : INT -> "int"
; dx : INT -> "int"
; dy : INT -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	msvfw32 = windows.NewLazySystemDLL("MSVFW32.dll")
	procICGetDisplayFormat = msvfw32.NewProc("ICGetDisplayFormat")
)

// hic (HIC optional), lpbiIn (BITMAPINFOHEADER*), lpbiOut (BITMAPINFOHEADER* out), BitDepth (INT), dx (INT), dy (INT)
r1, _, err := procICGetDisplayFormat.Call(
	uintptr(hic),
	uintptr(lpbiIn),
	uintptr(lpbiOut),
	uintptr(BitDepth),
	uintptr(dx),
	uintptr(dy),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HIC
function ICGetDisplayFormat(
  hic: THandle;   // HIC optional
  lpbiIn: Pointer;   // BITMAPINFOHEADER*
  lpbiOut: Pointer;   // BITMAPINFOHEADER* out
  BitDepth: Integer;   // INT
  dx: Integer;   // INT
  dy: Integer   // INT
): THandle; stdcall;
  external 'MSVFW32.dll' name 'ICGetDisplayFormat';
result := DllCall("MSVFW32\ICGetDisplayFormat"
    , "Ptr", hic   ; HIC optional
    , "Ptr", lpbiIn   ; BITMAPINFOHEADER*
    , "Ptr", lpbiOut   ; BITMAPINFOHEADER* out
    , "Int", BitDepth   ; INT
    , "Int", dx   ; INT
    , "Int", dy   ; INT
    , "Ptr")   ; return: HIC
●ICGetDisplayFormat(hic, lpbiIn, lpbiOut, BitDepth, dx, dy) = DLL("MSVFW32.dll", "void* ICGetDisplayFormat(void*, void*, void*, int, int, int)")
# 呼び出し: ICGetDisplayFormat(hic, lpbiIn, lpbiOut, BitDepth, dx, dy)
# hic : HIC optional -> "void*"
# lpbiIn : BITMAPINFOHEADER* -> "void*"
# lpbiOut : BITMAPINFOHEADER* out -> "void*"
# BitDepth : INT -> "int"
# dx : INT -> "int"
# dy : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "msvfw32" fn ICGetDisplayFormat(
    hic: ?*anyopaque, // HIC optional
    lpbiIn: [*c]BITMAPINFOHEADER, // BITMAPINFOHEADER*
    lpbiOut: [*c]BITMAPINFOHEADER, // BITMAPINFOHEADER* out
    BitDepth: i32, // INT
    dx: i32, // INT
    dy: i32 // INT
) callconv(std.os.windows.WINAPI) ?*anyopaque;
proc ICGetDisplayFormat(
    hic: pointer,  # HIC optional
    lpbiIn: ptr BITMAPINFOHEADER,  # BITMAPINFOHEADER*
    lpbiOut: ptr BITMAPINFOHEADER,  # BITMAPINFOHEADER* out
    BitDepth: int32,  # INT
    dx: int32,  # INT
    dy: int32  # INT
): pointer {.importc: "ICGetDisplayFormat", stdcall, dynlib: "MSVFW32.dll".}
pragma(lib, "msvfw32");
extern(Windows)
void* ICGetDisplayFormat(
    void* hic,   // HIC optional
    BITMAPINFOHEADER* lpbiIn,   // BITMAPINFOHEADER*
    BITMAPINFOHEADER* lpbiOut,   // BITMAPINFOHEADER* out
    int BitDepth,   // INT
    int dx,   // INT
    int dy   // INT
);
ccall((:ICGetDisplayFormat, "MSVFW32.dll"), stdcall, Ptr{Cvoid},
      (Ptr{Cvoid}, Ptr{BITMAPINFOHEADER}, Ptr{BITMAPINFOHEADER}, Int32, Int32, Int32),
      hic, lpbiIn, lpbiOut, BitDepth, dx, dy)
# hic : HIC optional -> Ptr{Cvoid}
# lpbiIn : BITMAPINFOHEADER* -> Ptr{BITMAPINFOHEADER}
# lpbiOut : BITMAPINFOHEADER* out -> Ptr{BITMAPINFOHEADER}
# BitDepth : INT -> Int32
# dx : INT -> Int32
# dy : INT -> Int32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
void* ICGetDisplayFormat(
    void* hic,
    void* lpbiIn,
    void* lpbiOut,
    int32_t BitDepth,
    int32_t dx,
    int32_t dy);
]]
local msvfw32 = ffi.load("msvfw32")
-- msvfw32.ICGetDisplayFormat(hic, lpbiIn, lpbiOut, BitDepth, dx, dy)
-- hic : HIC optional
-- lpbiIn : BITMAPINFOHEADER*
-- lpbiOut : BITMAPINFOHEADER* out
-- BitDepth : INT
-- dx : INT
-- dy : INT
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('MSVFW32.dll');
const ICGetDisplayFormat = lib.func('__stdcall', 'ICGetDisplayFormat', 'void *', ['void *', 'void *', 'void *', 'int32_t', 'int32_t', 'int32_t']);
// ICGetDisplayFormat(hic, lpbiIn, lpbiOut, BitDepth, dx, dy)
// hic : HIC optional -> 'void *'
// lpbiIn : BITMAPINFOHEADER* -> 'void *'
// lpbiOut : BITMAPINFOHEADER* out -> 'void *'
// BitDepth : INT -> 'int32_t'
// dx : INT -> 'int32_t'
// dy : INT -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("MSVFW32.dll", {
  ICGetDisplayFormat: { parameters: ["pointer", "pointer", "pointer", "i32", "i32", "i32"], result: "pointer" },
});
// lib.symbols.ICGetDisplayFormat(hic, lpbiIn, lpbiOut, BitDepth, dx, dy)
// hic : HIC optional -> "pointer"
// lpbiIn : BITMAPINFOHEADER* -> "pointer"
// lpbiOut : BITMAPINFOHEADER* out -> "pointer"
// BitDepth : INT -> "i32"
// dx : INT -> "i32"
// dy : INT -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
void* ICGetDisplayFormat(
    void* hic,
    void* lpbiIn,
    void* lpbiOut,
    int32_t BitDepth,
    int32_t dx,
    int32_t dy);
C, "MSVFW32.dll");
// $ffi->ICGetDisplayFormat(hic, lpbiIn, lpbiOut, BitDepth, dx, dy);
// hic : HIC optional
// lpbiIn : BITMAPINFOHEADER*
// lpbiOut : BITMAPINFOHEADER* out
// BitDepth : INT
// dx : INT
// dy : INT
// 構造体/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 Msvfw32 extends StdCallLibrary {
    Msvfw32 INSTANCE = Native.load("msvfw32", Msvfw32.class);
    Pointer ICGetDisplayFormat(
        Pointer hic,   // HIC optional
        Pointer lpbiIn,   // BITMAPINFOHEADER*
        Pointer lpbiOut,   // BITMAPINFOHEADER* out
        int BitDepth,   // INT
        int dx,   // INT
        int dy   // INT
    );
}
@[Link("msvfw32")]
lib LibMSVFW32
  fun ICGetDisplayFormat = ICGetDisplayFormat(
    hic : Void*,   # HIC optional
    lpbiIn : BITMAPINFOHEADER*,   # BITMAPINFOHEADER*
    lpbiOut : BITMAPINFOHEADER*,   # BITMAPINFOHEADER* out
    BitDepth : Int32,   # INT
    dx : Int32,   # INT
    dy : Int32   # INT
  ) : Void*
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef ICGetDisplayFormatNative = Pointer<Void> Function(Pointer<Void>, Pointer<Void>, Pointer<Void>, Int32, Int32, Int32);
typedef ICGetDisplayFormatDart = Pointer<Void> Function(Pointer<Void>, Pointer<Void>, Pointer<Void>, int, int, int);
final ICGetDisplayFormat = DynamicLibrary.open('MSVFW32.dll')
    .lookupFunction<ICGetDisplayFormatNative, ICGetDisplayFormatDart>('ICGetDisplayFormat');
// hic : HIC optional -> Pointer<Void>
// lpbiIn : BITMAPINFOHEADER* -> Pointer<Void>
// lpbiOut : BITMAPINFOHEADER* out -> Pointer<Void>
// BitDepth : INT -> Int32
// dx : INT -> Int32
// dy : INT -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function ICGetDisplayFormat(
  hic: THandle;   // HIC optional
  lpbiIn: Pointer;   // BITMAPINFOHEADER*
  lpbiOut: Pointer;   // BITMAPINFOHEADER* out
  BitDepth: Integer;   // INT
  dx: Integer;   // INT
  dy: Integer   // INT
): THandle; stdcall;
  external 'MSVFW32.dll' name 'ICGetDisplayFormat';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "ICGetDisplayFormat"
  c_ICGetDisplayFormat :: Ptr () -> Ptr () -> Ptr () -> Int32 -> Int32 -> Int32 -> IO (Ptr ())
-- hic : HIC optional -> Ptr ()
-- lpbiIn : BITMAPINFOHEADER* -> Ptr ()
-- lpbiOut : BITMAPINFOHEADER* out -> Ptr ()
-- BitDepth : INT -> Int32
-- dx : INT -> Int32
-- dy : INT -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let icgetdisplayformat =
  foreign "ICGetDisplayFormat"
    ((ptr void) @-> (ptr void) @-> (ptr void) @-> int32_t @-> int32_t @-> int32_t @-> returning (ptr void))
(* hic : HIC optional -> (ptr void) *)
(* lpbiIn : BITMAPINFOHEADER* -> (ptr void) *)
(* lpbiOut : BITMAPINFOHEADER* out -> (ptr void) *)
(* BitDepth : INT -> int32_t *)
(* dx : INT -> int32_t *)
(* dy : INT -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library msvfw32 (t "MSVFW32.dll"))
(cffi:use-foreign-library msvfw32)

(cffi:defcfun ("ICGetDisplayFormat" icget-display-format :convention :stdcall) :pointer
  (hic :pointer)   ; HIC optional
  (lpbi-in :pointer)   ; BITMAPINFOHEADER*
  (lpbi-out :pointer)   ; BITMAPINFOHEADER* out
  (bit-depth :int32)   ; INT
  (dx :int32)   ; INT
  (dy :int32))   ; INT
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $ICGetDisplayFormat = Win32::API::More->new('MSVFW32',
    'HANDLE ICGetDisplayFormat(HANDLE hic, LPVOID lpbiIn, LPVOID lpbiOut, int BitDepth, int dx, int dy)');
# my $ret = $ICGetDisplayFormat->Call($hic, $lpbiIn, $lpbiOut, $BitDepth, $dx, $dy);
# hic : HIC optional -> HANDLE
# lpbiIn : BITMAPINFOHEADER* -> LPVOID
# lpbiOut : BITMAPINFOHEADER* out -> LPVOID
# BitDepth : INT -> int
# dx : INT -> int
# dy : INT -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型