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

ICOpenFunction

関数
ハンドラ関数を指定して映像圧縮ドライバーを開く。
DLLMSVFW32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

HIC ICOpenFunction(
    DWORD fccType,
    DWORD fccHandler,
    DWORD wMode,
    FARPROC lpfnHandler
);

パラメーター

名前方向
fccTypeDWORDin
fccHandlerDWORDin
wModeDWORDin
lpfnHandlerFARPROCin

戻り値の型: HIC

各言語での呼び出し定義

// 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   // HIC
function 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)。