ホーム › Media.Multimedia › ICOpenFunction
ICOpenFunction
関数ハンドラ関数を指定して映像圧縮ドライバーを開く。
シグネチャ
// MSVFW32.dll
#include <windows.h>
HIC ICOpenFunction(
DWORD fccType,
DWORD fccHandler,
DWORD wMode,
FARPROC lpfnHandler
);パラメーター
| 名前 | 型 | 方向 | 説明 | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| fccType | DWORD | in | 開くコンプレッサーの種類。ビデオの場合、このパラメーターの値は ICTYPE_VIDEO です。 | ||||||||||||||
| fccHandler | DWORD | in | 指定した種類で優先的に使用するハンドラー。通常、これは AVI ファイル内のストリームヘッダーから取得されます。 | ||||||||||||||
| wMode | DWORD | in | コンプレッサーまたはデコンプレッサーの用途を定義するフラグ。次の値が定義されています。
| ||||||||||||||
| lpfnHandler | FARPROC | in | コンプレッサーまたはデコンプレッサーとして使用される関数へのポインター。 |
戻り値の型: HIC
公式ドキュメント
ICOpenFunction 関数は、関数として定義されたコンプレッサーまたはデコンプレッサーを開きます。
戻り値
成功した場合はコンプレッサーまたはデコンプレッサーへのハンドルを返し、それ以外の場合は 0 を返します。
出典・ライセンス: 上記「公式ドキュメント」の内容は 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 ICOpenFunction(
DWORD fccType,
DWORD fccHandler,
DWORD wMode,
FARPROC lpfnHandler
);[DllImport("MSVFW32.dll", ExactSpelling = true)]
static extern IntPtr ICOpenFunction(
uint fccType, // DWORD
uint fccHandler, // DWORD
uint wMode, // DWORD
IntPtr lpfnHandler // FARPROC
);<DllImport("MSVFW32.dll", ExactSpelling:=True)>
Public Shared Function ICOpenFunction(
fccType As UInteger, ' DWORD
fccHandler As UInteger, ' DWORD
wMode As UInteger, ' DWORD
lpfnHandler As IntPtr ' FARPROC
) As IntPtr
End Function' fccType : DWORD
' fccHandler : DWORD
' wMode : DWORD
' lpfnHandler : FARPROC
Declare PtrSafe Function ICOpenFunction Lib "msvfw32" ( _
ByVal fccType As Long, _
ByVal fccHandler As Long, _
ByVal wMode As Long, _
ByVal lpfnHandler As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ICOpenFunction = ctypes.windll.msvfw32.ICOpenFunction
ICOpenFunction.restype = ctypes.c_void_p
ICOpenFunction.argtypes = [
wintypes.DWORD, # fccType : DWORD
wintypes.DWORD, # fccHandler : DWORD
wintypes.DWORD, # wMode : DWORD
ctypes.c_void_p, # lpfnHandler : FARPROC
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MSVFW32.dll')
ICOpenFunction = Fiddle::Function.new(
lib['ICOpenFunction'],
[
-Fiddle::TYPE_INT, # fccType : DWORD
-Fiddle::TYPE_INT, # fccHandler : DWORD
-Fiddle::TYPE_INT, # wMode : DWORD
Fiddle::TYPE_VOIDP, # lpfnHandler : FARPROC
],
Fiddle::TYPE_VOIDP)#[link(name = "msvfw32")]
extern "system" {
fn ICOpenFunction(
fccType: u32, // DWORD
fccHandler: u32, // DWORD
wMode: u32, // DWORD
lpfnHandler: *const core::ffi::c_void // FARPROC
) -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("MSVFW32.dll")]
public static extern IntPtr ICOpenFunction(uint fccType, uint fccHandler, uint wMode, IntPtr lpfnHandler);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MSVFW32_ICOpenFunction' -Namespace Win32 -PassThru
# $api::ICOpenFunction(fccType, fccHandler, wMode, lpfnHandler)#uselib "MSVFW32.dll"
#func global ICOpenFunction "ICOpenFunction" sptr, sptr, sptr, sptr
; ICOpenFunction fccType, fccHandler, wMode, lpfnHandler ; 戻り値は stat
; fccType : DWORD -> "sptr"
; fccHandler : DWORD -> "sptr"
; wMode : DWORD -> "sptr"
; lpfnHandler : FARPROC -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "MSVFW32.dll"
#cfunc global ICOpenFunction "ICOpenFunction" int, int, int, sptr
; res = ICOpenFunction(fccType, fccHandler, wMode, lpfnHandler)
; fccType : DWORD -> "int"
; fccHandler : DWORD -> "int"
; wMode : DWORD -> "int"
; lpfnHandler : FARPROC -> "sptr"; HIC ICOpenFunction(DWORD fccType, DWORD fccHandler, DWORD wMode, FARPROC lpfnHandler)
#uselib "MSVFW32.dll"
#cfunc global ICOpenFunction "ICOpenFunction" int, int, int, intptr
; res = ICOpenFunction(fccType, fccHandler, wMode, lpfnHandler)
; fccType : DWORD -> "int"
; fccHandler : DWORD -> "int"
; wMode : DWORD -> "int"
; lpfnHandler : FARPROC -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
msvfw32 = windows.NewLazySystemDLL("MSVFW32.dll")
procICOpenFunction = msvfw32.NewProc("ICOpenFunction")
)
// fccType (DWORD), fccHandler (DWORD), wMode (DWORD), lpfnHandler (FARPROC)
r1, _, err := procICOpenFunction.Call(
uintptr(fccType),
uintptr(fccHandler),
uintptr(wMode),
uintptr(lpfnHandler),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HICfunction ICOpenFunction(
fccType: DWORD; // DWORD
fccHandler: DWORD; // DWORD
wMode: DWORD; // DWORD
lpfnHandler: Pointer // FARPROC
): THandle; stdcall;
external 'MSVFW32.dll' name 'ICOpenFunction';result := DllCall("MSVFW32\ICOpenFunction"
, "UInt", fccType ; DWORD
, "UInt", fccHandler ; DWORD
, "UInt", wMode ; DWORD
, "Ptr", lpfnHandler ; FARPROC
, "Ptr") ; return: HIC●ICOpenFunction(fccType, fccHandler, wMode, lpfnHandler) = DLL("MSVFW32.dll", "void* ICOpenFunction(dword, dword, dword, void*)")
# 呼び出し: ICOpenFunction(fccType, fccHandler, wMode, lpfnHandler)
# fccType : DWORD -> "dword"
# fccHandler : DWORD -> "dword"
# wMode : DWORD -> "dword"
# lpfnHandler : FARPROC -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "msvfw32" fn ICOpenFunction(
fccType: u32, // DWORD
fccHandler: u32, // DWORD
wMode: u32, // DWORD
lpfnHandler: ?*anyopaque // FARPROC
) callconv(std.os.windows.WINAPI) ?*anyopaque;proc ICOpenFunction(
fccType: uint32, # DWORD
fccHandler: uint32, # DWORD
wMode: uint32, # DWORD
lpfnHandler: pointer # FARPROC
): pointer {.importc: "ICOpenFunction", stdcall, dynlib: "MSVFW32.dll".}pragma(lib, "msvfw32");
extern(Windows)
void* ICOpenFunction(
uint fccType, // DWORD
uint fccHandler, // DWORD
uint wMode, // DWORD
void* lpfnHandler // FARPROC
);ccall((:ICOpenFunction, "MSVFW32.dll"), stdcall, Ptr{Cvoid},
(UInt32, UInt32, UInt32, Ptr{Cvoid}),
fccType, fccHandler, wMode, lpfnHandler)
# fccType : DWORD -> UInt32
# fccHandler : DWORD -> UInt32
# wMode : DWORD -> UInt32
# lpfnHandler : FARPROC -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
void* ICOpenFunction(
uint32_t fccType,
uint32_t fccHandler,
uint32_t wMode,
void* lpfnHandler);
]]
local msvfw32 = ffi.load("msvfw32")
-- msvfw32.ICOpenFunction(fccType, fccHandler, wMode, lpfnHandler)
-- fccType : DWORD
-- fccHandler : DWORD
-- wMode : DWORD
-- lpfnHandler : FARPROC
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('MSVFW32.dll');
const ICOpenFunction = lib.func('__stdcall', 'ICOpenFunction', 'void *', ['uint32_t', 'uint32_t', 'uint32_t', 'void *']);
// ICOpenFunction(fccType, fccHandler, wMode, lpfnHandler)
// fccType : DWORD -> 'uint32_t'
// fccHandler : DWORD -> 'uint32_t'
// wMode : DWORD -> 'uint32_t'
// lpfnHandler : FARPROC -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
// コールバック(関数ポインタ)は koffi.proto/koffi.register で型を定義して渡す(素の void* では JS 関数を渡せない)。const lib = Deno.dlopen("MSVFW32.dll", {
ICOpenFunction: { parameters: ["u32", "u32", "u32", "pointer"], result: "pointer" },
});
// lib.symbols.ICOpenFunction(fccType, fccHandler, wMode, lpfnHandler)
// fccType : DWORD -> "u32"
// fccHandler : DWORD -> "u32"
// wMode : DWORD -> "u32"
// lpfnHandler : FARPROC -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
void* ICOpenFunction(
uint32_t fccType,
uint32_t fccHandler,
uint32_t wMode,
void* lpfnHandler);
C, "MSVFW32.dll");
// $ffi->ICOpenFunction(fccType, fccHandler, wMode, lpfnHandler);
// fccType : DWORD
// fccHandler : DWORD
// wMode : DWORD
// lpfnHandler : FARPROC
// 構造体/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 ICOpenFunction(
int fccType, // DWORD
int fccHandler, // DWORD
int wMode, // DWORD
Callback lpfnHandler // FARPROC
);
}@[Link("msvfw32")]
lib LibMSVFW32
fun ICOpenFunction = ICOpenFunction(
fccType : UInt32, # DWORD
fccHandler : UInt32, # DWORD
wMode : UInt32, # DWORD
lpfnHandler : Void* # FARPROC
) : Void*
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef ICOpenFunctionNative = Pointer<Void> Function(Uint32, Uint32, Uint32, Pointer<Void>);
typedef ICOpenFunctionDart = Pointer<Void> Function(int, int, int, Pointer<Void>);
final ICOpenFunction = DynamicLibrary.open('MSVFW32.dll')
.lookupFunction<ICOpenFunctionNative, ICOpenFunctionDart>('ICOpenFunction');
// fccType : DWORD -> Uint32
// fccHandler : DWORD -> Uint32
// wMode : DWORD -> Uint32
// lpfnHandler : FARPROC -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function ICOpenFunction(
fccType: DWORD; // DWORD
fccHandler: DWORD; // DWORD
wMode: DWORD; // DWORD
lpfnHandler: Pointer // FARPROC
): THandle; stdcall;
external 'MSVFW32.dll' name 'ICOpenFunction';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "ICOpenFunction"
c_ICOpenFunction :: Word32 -> Word32 -> Word32 -> Ptr () -> IO (Ptr ())
-- fccType : DWORD -> Word32
-- fccHandler : DWORD -> Word32
-- wMode : DWORD -> Word32
-- lpfnHandler : FARPROC -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let icopenfunction =
foreign "ICOpenFunction"
(uint32_t @-> uint32_t @-> uint32_t @-> (ptr void) @-> returning (ptr void))
(* fccType : DWORD -> uint32_t *)
(* fccHandler : DWORD -> uint32_t *)
(* wMode : DWORD -> uint32_t *)
(* lpfnHandler : FARPROC -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library msvfw32 (t "MSVFW32.dll"))
(cffi:use-foreign-library msvfw32)
(cffi:defcfun ("ICOpenFunction" icopen-function :convention :stdcall) :pointer
(fcc-type :uint32) ; DWORD
(fcc-handler :uint32) ; DWORD
(w-mode :uint32) ; DWORD
(lpfn-handler :pointer)) ; FARPROC
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $ICOpenFunction = Win32::API::More->new('MSVFW32',
'HANDLE ICOpenFunction(DWORD fccType, DWORD fccHandler, DWORD wMode, LPVOID lpfnHandler)');
# my $ret = $ICOpenFunction->Call($fccType, $fccHandler, $wMode, $lpfnHandler);
# fccType : DWORD -> DWORD
# fccHandler : DWORD -> DWORD
# wMode : DWORD -> DWORD
# lpfnHandler : FARPROC -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# コールバック(関数ポインタ)は Perl sub を直接渡せません。Win32::API::Callback を使用してください。関連項目
使用する型