ホーム › Media.Multimedia › ICLocate
ICLocate
関数指定形式に対応する映像圧縮ドライバーを検索して開く。
シグネチャ
// MSVFW32.dll
#include <windows.h>
HIC ICLocate(
DWORD fccType,
DWORD fccHandler,
BITMAPINFOHEADER* lpbiIn,
BITMAPINFOHEADER* lpbiOut, // optional
WORD wFlags
);パラメーター
| 名前 | 型 | 方向 | 説明 | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| fccType | DWORD | in | 開くコンプレッサーまたはデコンプレッサーの種類を示す 4 文字コードです。ビデオストリームの場合、このパラメーターの値は 'VIDC' です。 | ||||||||||||
| fccHandler | DWORD | in | 指定された種類の優先ハンドラーです。通常、ハンドラーの種類は AVI ファイルのストリームヘッダーに格納されています。アプリケーションが任意のハンドラーの種類を使用できる場合、または使用するハンドラーの種類が不明な場合は、NULL を指定します。 | ||||||||||||
| lpbiIn | BITMAPINFOHEADER* | in | 入力形式を定義する BITMAPINFOHEADER 構造体へのポインターです。コンプレッサーがこの形式をサポートしていない限り、コンプレッサーのハンドルは返されません。 | ||||||||||||
| lpbiOut | BITMAPINFOHEADER* | inoptional | 省略可能な展開後の形式を定義する BITMAPINFOHEADER 構造体へのポインターです。入力形式に関連付けられた既定の出力形式を使用するには、ゼロを指定することもできます。 このパラメーターが 0 以外の場合、コンプレッサーがこの出力形式を作成できない限り、コンプレッサーのハンドルは返されません。 | ||||||||||||
| wFlags | WORD | in | コンプレッサーまたはデコンプレッサーの検索条件を表すフラグです。次の値が定義されています。
|
戻り値の型: HIC
公式ドキュメント
ICLocate 関数は、指定された形式の画像を処理できるコンプレッサーまたはデコンプレッサーを検索します。または、指定された形式の画像をハードウェアへ直接展開できるドライバーを検索します。
戻り値
成功した場合はコンプレッサーまたはデコンプレッサーのハンドルを返し、失敗した場合はゼロを返します。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// MSVFW32.dll
#include <windows.h>
HIC ICLocate(
DWORD fccType,
DWORD fccHandler,
BITMAPINFOHEADER* lpbiIn,
BITMAPINFOHEADER* lpbiOut, // optional
WORD wFlags
);[DllImport("MSVFW32.dll", ExactSpelling = true)]
static extern IntPtr ICLocate(
uint fccType, // DWORD
uint fccHandler, // DWORD
IntPtr lpbiIn, // BITMAPINFOHEADER*
IntPtr lpbiOut, // BITMAPINFOHEADER* optional
ushort wFlags // WORD
);<DllImport("MSVFW32.dll", ExactSpelling:=True)>
Public Shared Function ICLocate(
fccType As UInteger, ' DWORD
fccHandler As UInteger, ' DWORD
lpbiIn As IntPtr, ' BITMAPINFOHEADER*
lpbiOut As IntPtr, ' BITMAPINFOHEADER* optional
wFlags As UShort ' WORD
) As IntPtr
End Function' fccType : DWORD
' fccHandler : DWORD
' lpbiIn : BITMAPINFOHEADER*
' lpbiOut : BITMAPINFOHEADER* optional
' wFlags : WORD
Declare PtrSafe Function ICLocate Lib "msvfw32" ( _
ByVal fccType As Long, _
ByVal fccHandler As Long, _
ByVal lpbiIn As LongPtr, _
ByVal lpbiOut As LongPtr, _
ByVal wFlags As Integer) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ICLocate = ctypes.windll.msvfw32.ICLocate
ICLocate.restype = ctypes.c_void_p
ICLocate.argtypes = [
wintypes.DWORD, # fccType : DWORD
wintypes.DWORD, # fccHandler : DWORD
ctypes.c_void_p, # lpbiIn : BITMAPINFOHEADER*
ctypes.c_void_p, # lpbiOut : BITMAPINFOHEADER* optional
ctypes.c_ushort, # wFlags : WORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MSVFW32.dll')
ICLocate = Fiddle::Function.new(
lib['ICLocate'],
[
-Fiddle::TYPE_INT, # fccType : DWORD
-Fiddle::TYPE_INT, # fccHandler : DWORD
Fiddle::TYPE_VOIDP, # lpbiIn : BITMAPINFOHEADER*
Fiddle::TYPE_VOIDP, # lpbiOut : BITMAPINFOHEADER* optional
-Fiddle::TYPE_SHORT, # wFlags : WORD
],
Fiddle::TYPE_VOIDP)#[link(name = "msvfw32")]
extern "system" {
fn ICLocate(
fccType: u32, // DWORD
fccHandler: u32, // DWORD
lpbiIn: *mut BITMAPINFOHEADER, // BITMAPINFOHEADER*
lpbiOut: *mut BITMAPINFOHEADER, // BITMAPINFOHEADER* optional
wFlags: u16 // WORD
) -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("MSVFW32.dll")]
public static extern IntPtr ICLocate(uint fccType, uint fccHandler, IntPtr lpbiIn, IntPtr lpbiOut, ushort wFlags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MSVFW32_ICLocate' -Namespace Win32 -PassThru
# $api::ICLocate(fccType, fccHandler, lpbiIn, lpbiOut, wFlags)#uselib "MSVFW32.dll"
#func global ICLocate "ICLocate" sptr, sptr, sptr, sptr, sptr
; ICLocate fccType, fccHandler, varptr(lpbiIn), varptr(lpbiOut), wFlags ; 戻り値は stat
; fccType : DWORD -> "sptr"
; fccHandler : DWORD -> "sptr"
; lpbiIn : BITMAPINFOHEADER* -> "sptr"
; lpbiOut : BITMAPINFOHEADER* optional -> "sptr"
; wFlags : WORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "MSVFW32.dll" #cfunc global ICLocate "ICLocate" int, int, var, var, int ; res = ICLocate(fccType, fccHandler, lpbiIn, lpbiOut, wFlags) ; fccType : DWORD -> "int" ; fccHandler : DWORD -> "int" ; lpbiIn : BITMAPINFOHEADER* -> "var" ; lpbiOut : BITMAPINFOHEADER* optional -> "var" ; wFlags : WORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "MSVFW32.dll" #cfunc global ICLocate "ICLocate" int, int, sptr, sptr, int ; res = ICLocate(fccType, fccHandler, varptr(lpbiIn), varptr(lpbiOut), wFlags) ; fccType : DWORD -> "int" ; fccHandler : DWORD -> "int" ; lpbiIn : BITMAPINFOHEADER* -> "sptr" ; lpbiOut : BITMAPINFOHEADER* optional -> "sptr" ; wFlags : WORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HIC ICLocate(DWORD fccType, DWORD fccHandler, BITMAPINFOHEADER* lpbiIn, BITMAPINFOHEADER* lpbiOut, WORD wFlags) #uselib "MSVFW32.dll" #cfunc global ICLocate "ICLocate" int, int, var, var, int ; res = ICLocate(fccType, fccHandler, lpbiIn, lpbiOut, wFlags) ; fccType : DWORD -> "int" ; fccHandler : DWORD -> "int" ; lpbiIn : BITMAPINFOHEADER* -> "var" ; lpbiOut : BITMAPINFOHEADER* optional -> "var" ; wFlags : WORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HIC ICLocate(DWORD fccType, DWORD fccHandler, BITMAPINFOHEADER* lpbiIn, BITMAPINFOHEADER* lpbiOut, WORD wFlags) #uselib "MSVFW32.dll" #cfunc global ICLocate "ICLocate" int, int, intptr, intptr, int ; res = ICLocate(fccType, fccHandler, varptr(lpbiIn), varptr(lpbiOut), wFlags) ; fccType : DWORD -> "int" ; fccHandler : DWORD -> "int" ; lpbiIn : BITMAPINFOHEADER* -> "intptr" ; lpbiOut : BITMAPINFOHEADER* optional -> "intptr" ; wFlags : WORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
msvfw32 = windows.NewLazySystemDLL("MSVFW32.dll")
procICLocate = msvfw32.NewProc("ICLocate")
)
// fccType (DWORD), fccHandler (DWORD), lpbiIn (BITMAPINFOHEADER*), lpbiOut (BITMAPINFOHEADER* optional), wFlags (WORD)
r1, _, err := procICLocate.Call(
uintptr(fccType),
uintptr(fccHandler),
uintptr(lpbiIn),
uintptr(lpbiOut),
uintptr(wFlags),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HICfunction ICLocate(
fccType: DWORD; // DWORD
fccHandler: DWORD; // DWORD
lpbiIn: Pointer; // BITMAPINFOHEADER*
lpbiOut: Pointer; // BITMAPINFOHEADER* optional
wFlags: Word // WORD
): THandle; stdcall;
external 'MSVFW32.dll' name 'ICLocate';result := DllCall("MSVFW32\ICLocate"
, "UInt", fccType ; DWORD
, "UInt", fccHandler ; DWORD
, "Ptr", lpbiIn ; BITMAPINFOHEADER*
, "Ptr", lpbiOut ; BITMAPINFOHEADER* optional
, "UShort", wFlags ; WORD
, "Ptr") ; return: HIC●ICLocate(fccType, fccHandler, lpbiIn, lpbiOut, wFlags) = DLL("MSVFW32.dll", "void* ICLocate(dword, dword, void*, void*, int)")
# 呼び出し: ICLocate(fccType, fccHandler, lpbiIn, lpbiOut, wFlags)
# fccType : DWORD -> "dword"
# fccHandler : DWORD -> "dword"
# lpbiIn : BITMAPINFOHEADER* -> "void*"
# lpbiOut : BITMAPINFOHEADER* optional -> "void*"
# wFlags : WORD -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "msvfw32" fn ICLocate(
fccType: u32, // DWORD
fccHandler: u32, // DWORD
lpbiIn: [*c]BITMAPINFOHEADER, // BITMAPINFOHEADER*
lpbiOut: [*c]BITMAPINFOHEADER, // BITMAPINFOHEADER* optional
wFlags: u16 // WORD
) callconv(std.os.windows.WINAPI) ?*anyopaque;proc ICLocate(
fccType: uint32, # DWORD
fccHandler: uint32, # DWORD
lpbiIn: ptr BITMAPINFOHEADER, # BITMAPINFOHEADER*
lpbiOut: ptr BITMAPINFOHEADER, # BITMAPINFOHEADER* optional
wFlags: uint16 # WORD
): pointer {.importc: "ICLocate", stdcall, dynlib: "MSVFW32.dll".}pragma(lib, "msvfw32");
extern(Windows)
void* ICLocate(
uint fccType, // DWORD
uint fccHandler, // DWORD
BITMAPINFOHEADER* lpbiIn, // BITMAPINFOHEADER*
BITMAPINFOHEADER* lpbiOut, // BITMAPINFOHEADER* optional
ushort wFlags // WORD
);ccall((:ICLocate, "MSVFW32.dll"), stdcall, Ptr{Cvoid},
(UInt32, UInt32, Ptr{BITMAPINFOHEADER}, Ptr{BITMAPINFOHEADER}, UInt16),
fccType, fccHandler, lpbiIn, lpbiOut, wFlags)
# fccType : DWORD -> UInt32
# fccHandler : DWORD -> UInt32
# lpbiIn : BITMAPINFOHEADER* -> Ptr{BITMAPINFOHEADER}
# lpbiOut : BITMAPINFOHEADER* optional -> Ptr{BITMAPINFOHEADER}
# wFlags : WORD -> UInt16
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
void* ICLocate(
uint32_t fccType,
uint32_t fccHandler,
void* lpbiIn,
void* lpbiOut,
uint16_t wFlags);
]]
local msvfw32 = ffi.load("msvfw32")
-- msvfw32.ICLocate(fccType, fccHandler, lpbiIn, lpbiOut, wFlags)
-- fccType : DWORD
-- fccHandler : DWORD
-- lpbiIn : BITMAPINFOHEADER*
-- lpbiOut : BITMAPINFOHEADER* optional
-- wFlags : WORD
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('MSVFW32.dll');
const ICLocate = lib.func('__stdcall', 'ICLocate', 'void *', ['uint32_t', 'uint32_t', 'void *', 'void *', 'uint16_t']);
// ICLocate(fccType, fccHandler, lpbiIn, lpbiOut, wFlags)
// fccType : DWORD -> 'uint32_t'
// fccHandler : DWORD -> 'uint32_t'
// lpbiIn : BITMAPINFOHEADER* -> 'void *'
// lpbiOut : BITMAPINFOHEADER* optional -> 'void *'
// wFlags : WORD -> 'uint16_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("MSVFW32.dll", {
ICLocate: { parameters: ["u32", "u32", "pointer", "pointer", "u16"], result: "pointer" },
});
// lib.symbols.ICLocate(fccType, fccHandler, lpbiIn, lpbiOut, wFlags)
// fccType : DWORD -> "u32"
// fccHandler : DWORD -> "u32"
// lpbiIn : BITMAPINFOHEADER* -> "pointer"
// lpbiOut : BITMAPINFOHEADER* optional -> "pointer"
// wFlags : WORD -> "u16"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
void* ICLocate(
uint32_t fccType,
uint32_t fccHandler,
void* lpbiIn,
void* lpbiOut,
uint16_t wFlags);
C, "MSVFW32.dll");
// $ffi->ICLocate(fccType, fccHandler, lpbiIn, lpbiOut, wFlags);
// fccType : DWORD
// fccHandler : DWORD
// lpbiIn : BITMAPINFOHEADER*
// lpbiOut : BITMAPINFOHEADER* optional
// wFlags : WORD
// 構造体/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 ICLocate(
int fccType, // DWORD
int fccHandler, // DWORD
Pointer lpbiIn, // BITMAPINFOHEADER*
Pointer lpbiOut, // BITMAPINFOHEADER* optional
short wFlags // WORD
);
}@[Link("msvfw32")]
lib LibMSVFW32
fun ICLocate = ICLocate(
fccType : UInt32, # DWORD
fccHandler : UInt32, # DWORD
lpbiIn : BITMAPINFOHEADER*, # BITMAPINFOHEADER*
lpbiOut : BITMAPINFOHEADER*, # BITMAPINFOHEADER* optional
wFlags : UInt16 # WORD
) : Void*
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef ICLocateNative = Pointer<Void> Function(Uint32, Uint32, Pointer<Void>, Pointer<Void>, Uint16);
typedef ICLocateDart = Pointer<Void> Function(int, int, Pointer<Void>, Pointer<Void>, int);
final ICLocate = DynamicLibrary.open('MSVFW32.dll')
.lookupFunction<ICLocateNative, ICLocateDart>('ICLocate');
// fccType : DWORD -> Uint32
// fccHandler : DWORD -> Uint32
// lpbiIn : BITMAPINFOHEADER* -> Pointer<Void>
// lpbiOut : BITMAPINFOHEADER* optional -> Pointer<Void>
// wFlags : WORD -> Uint16
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function ICLocate(
fccType: DWORD; // DWORD
fccHandler: DWORD; // DWORD
lpbiIn: Pointer; // BITMAPINFOHEADER*
lpbiOut: Pointer; // BITMAPINFOHEADER* optional
wFlags: Word // WORD
): THandle; stdcall;
external 'MSVFW32.dll' name 'ICLocate';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "ICLocate"
c_ICLocate :: Word32 -> Word32 -> Ptr () -> Ptr () -> Word16 -> IO (Ptr ())
-- fccType : DWORD -> Word32
-- fccHandler : DWORD -> Word32
-- lpbiIn : BITMAPINFOHEADER* -> Ptr ()
-- lpbiOut : BITMAPINFOHEADER* optional -> Ptr ()
-- wFlags : WORD -> Word16
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let iclocate =
foreign "ICLocate"
(uint32_t @-> uint32_t @-> (ptr void) @-> (ptr void) @-> uint16_t @-> returning (ptr void))
(* fccType : DWORD -> uint32_t *)
(* fccHandler : DWORD -> uint32_t *)
(* lpbiIn : BITMAPINFOHEADER* -> (ptr void) *)
(* lpbiOut : BITMAPINFOHEADER* optional -> (ptr void) *)
(* wFlags : WORD -> uint16_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library msvfw32 (t "MSVFW32.dll"))
(cffi:use-foreign-library msvfw32)
(cffi:defcfun ("ICLocate" iclocate :convention :stdcall) :pointer
(fcc-type :uint32) ; DWORD
(fcc-handler :uint32) ; DWORD
(lpbi-in :pointer) ; BITMAPINFOHEADER*
(lpbi-out :pointer) ; BITMAPINFOHEADER* optional
(w-flags :uint16)) ; WORD
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $ICLocate = Win32::API::More->new('MSVFW32',
'HANDLE ICLocate(DWORD fccType, DWORD fccHandler, LPVOID lpbiIn, LPVOID lpbiOut, WORD wFlags)');
# my $ret = $ICLocate->Call($fccType, $fccHandler, $lpbiIn, $lpbiOut, $wFlags);
# fccType : DWORD -> DWORD
# fccHandler : DWORD -> DWORD
# lpbiIn : BITMAPINFOHEADER* -> LPVOID
# lpbiOut : BITMAPINFOHEADER* optional -> LPVOID
# wFlags : WORD -> WORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型