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

ICSendMessage

関数
映像圧縮ドライバーにメッセージを送信する。
DLLMSVFW32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

LRESULT ICSendMessage(
    HIC hic,
    DWORD msg,
    UINT_PTR dw1,
    UINT_PTR dw2
);

パラメーター

名前方向説明
hicHICinメッセージを受け取るコンプレッサーへのハンドル。
msgDWORDin送信するメッセージ。
dw1UINT_PTRinメッセージ固有の追加情報。
dw2UINT_PTRinメッセージ固有の追加情報。

戻り値の型: LRESULT

公式ドキュメント

ICSendMessage 関数は、コンプレッサーにメッセージを送信します。

戻り値

メッセージ固有の結果を返します。

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

各言語での呼び出し定義

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

LRESULT ICSendMessage(
    HIC hic,
    DWORD msg,
    UINT_PTR dw1,
    UINT_PTR dw2
);
[DllImport("MSVFW32.dll", ExactSpelling = true)]
static extern IntPtr ICSendMessage(
    IntPtr hic,   // HIC
    uint msg,   // DWORD
    UIntPtr dw1,   // UINT_PTR
    UIntPtr dw2   // UINT_PTR
);
<DllImport("MSVFW32.dll", ExactSpelling:=True)>
Public Shared Function ICSendMessage(
    hic As IntPtr,   ' HIC
    msg As UInteger,   ' DWORD
    dw1 As UIntPtr,   ' UINT_PTR
    dw2 As UIntPtr   ' UINT_PTR
) As IntPtr
End Function
' hic : HIC
' msg : DWORD
' dw1 : UINT_PTR
' dw2 : UINT_PTR
Declare PtrSafe Function ICSendMessage Lib "msvfw32" ( _
    ByVal hic As LongPtr, _
    ByVal msg As Long, _
    ByVal dw1 As LongPtr, _
    ByVal dw2 As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ICSendMessage = ctypes.windll.msvfw32.ICSendMessage
ICSendMessage.restype = ctypes.c_ssize_t
ICSendMessage.argtypes = [
    wintypes.HANDLE,  # hic : HIC
    wintypes.DWORD,  # msg : DWORD
    ctypes.c_size_t,  # dw1 : UINT_PTR
    ctypes.c_size_t,  # dw2 : UINT_PTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MSVFW32.dll')
ICSendMessage = Fiddle::Function.new(
  lib['ICSendMessage'],
  [
    Fiddle::TYPE_VOIDP,  # hic : HIC
    -Fiddle::TYPE_INT,  # msg : DWORD
    Fiddle::TYPE_UINTPTR_T,  # dw1 : UINT_PTR
    Fiddle::TYPE_UINTPTR_T,  # dw2 : UINT_PTR
  ],
  Fiddle::TYPE_INTPTR_T)
#[link(name = "msvfw32")]
extern "system" {
    fn ICSendMessage(
        hic: *mut core::ffi::c_void,  // HIC
        msg: u32,  // DWORD
        dw1: usize,  // UINT_PTR
        dw2: usize  // UINT_PTR
    ) -> isize;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("MSVFW32.dll")]
public static extern IntPtr ICSendMessage(IntPtr hic, uint msg, UIntPtr dw1, UIntPtr dw2);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MSVFW32_ICSendMessage' -Namespace Win32 -PassThru
# $api::ICSendMessage(hic, msg, dw1, dw2)
#uselib "MSVFW32.dll"
#func global ICSendMessage "ICSendMessage" sptr, sptr, sptr, sptr
; ICSendMessage hic, msg, dw1, dw2   ; 戻り値は stat
; hic : HIC -> "sptr"
; msg : DWORD -> "sptr"
; dw1 : UINT_PTR -> "sptr"
; dw2 : UINT_PTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "MSVFW32.dll"
#cfunc global ICSendMessage "ICSendMessage" sptr, int, sptr, sptr
; res = ICSendMessage(hic, msg, dw1, dw2)
; hic : HIC -> "sptr"
; msg : DWORD -> "int"
; dw1 : UINT_PTR -> "sptr"
; dw2 : UINT_PTR -> "sptr"
; LRESULT ICSendMessage(HIC hic, DWORD msg, UINT_PTR dw1, UINT_PTR dw2)
#uselib "MSVFW32.dll"
#cfunc global ICSendMessage "ICSendMessage" intptr, int, intptr, intptr
; res = ICSendMessage(hic, msg, dw1, dw2)
; hic : HIC -> "intptr"
; msg : DWORD -> "int"
; dw1 : UINT_PTR -> "intptr"
; dw2 : UINT_PTR -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	msvfw32 = windows.NewLazySystemDLL("MSVFW32.dll")
	procICSendMessage = msvfw32.NewProc("ICSendMessage")
)

// hic (HIC), msg (DWORD), dw1 (UINT_PTR), dw2 (UINT_PTR)
r1, _, err := procICSendMessage.Call(
	uintptr(hic),
	uintptr(msg),
	uintptr(dw1),
	uintptr(dw2),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // LRESULT
function ICSendMessage(
  hic: THandle;   // HIC
  msg: DWORD;   // DWORD
  dw1: NativeUInt;   // UINT_PTR
  dw2: NativeUInt   // UINT_PTR
): NativeInt; stdcall;
  external 'MSVFW32.dll' name 'ICSendMessage';
result := DllCall("MSVFW32\ICSendMessage"
    , "Ptr", hic   ; HIC
    , "UInt", msg   ; DWORD
    , "UPtr", dw1   ; UINT_PTR
    , "UPtr", dw2   ; UINT_PTR
    , "Ptr")   ; return: LRESULT
●ICSendMessage(hic, msg, dw1, dw2) = DLL("MSVFW32.dll", "int ICSendMessage(void*, dword, int, int)")
# 呼び出し: ICSendMessage(hic, msg, dw1, dw2)
# hic : HIC -> "void*"
# msg : DWORD -> "dword"
# dw1 : UINT_PTR -> "int"
# dw2 : UINT_PTR -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "msvfw32" fn ICSendMessage(
    hic: ?*anyopaque, // HIC
    msg: u32, // DWORD
    dw1: usize, // UINT_PTR
    dw2: usize // UINT_PTR
) callconv(std.os.windows.WINAPI) isize;
proc ICSendMessage(
    hic: pointer,  # HIC
    msg: uint32,  # DWORD
    dw1: uint,  # UINT_PTR
    dw2: uint  # UINT_PTR
): int {.importc: "ICSendMessage", stdcall, dynlib: "MSVFW32.dll".}
pragma(lib, "msvfw32");
extern(Windows)
ptrdiff_t ICSendMessage(
    void* hic,   // HIC
    uint msg,   // DWORD
    size_t dw1,   // UINT_PTR
    size_t dw2   // UINT_PTR
);
ccall((:ICSendMessage, "MSVFW32.dll"), stdcall, Int,
      (Ptr{Cvoid}, UInt32, Csize_t, Csize_t),
      hic, msg, dw1, dw2)
# hic : HIC -> Ptr{Cvoid}
# msg : DWORD -> UInt32
# dw1 : UINT_PTR -> Csize_t
# dw2 : UINT_PTR -> Csize_t
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
intptr_t ICSendMessage(
    void* hic,
    uint32_t msg,
    uintptr_t dw1,
    uintptr_t dw2);
]]
local msvfw32 = ffi.load("msvfw32")
-- msvfw32.ICSendMessage(hic, msg, dw1, dw2)
-- hic : HIC
-- msg : DWORD
-- dw1 : UINT_PTR
-- dw2 : UINT_PTR
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('MSVFW32.dll');
const ICSendMessage = lib.func('__stdcall', 'ICSendMessage', 'intptr_t', ['void *', 'uint32_t', 'uintptr_t', 'uintptr_t']);
// ICSendMessage(hic, msg, dw1, dw2)
// hic : HIC -> 'void *'
// msg : DWORD -> 'uint32_t'
// dw1 : UINT_PTR -> 'uintptr_t'
// dw2 : UINT_PTR -> 'uintptr_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("MSVFW32.dll", {
  ICSendMessage: { parameters: ["pointer", "u32", "usize", "usize"], result: "isize" },
});
// lib.symbols.ICSendMessage(hic, msg, dw1, dw2)
// hic : HIC -> "pointer"
// msg : DWORD -> "u32"
// dw1 : UINT_PTR -> "usize"
// dw2 : UINT_PTR -> "usize"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
intptr_t ICSendMessage(
    void* hic,
    uint32_t msg,
    size_t dw1,
    size_t dw2);
C, "MSVFW32.dll");
// $ffi->ICSendMessage(hic, msg, dw1, dw2);
// hic : HIC
// msg : DWORD
// dw1 : UINT_PTR
// dw2 : UINT_PTR
// 構造体/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);
    long ICSendMessage(
        Pointer hic,   // HIC
        int msg,   // DWORD
        long dw1,   // UINT_PTR
        long dw2   // UINT_PTR
    );
}
@[Link("msvfw32")]
lib LibMSVFW32
  fun ICSendMessage = ICSendMessage(
    hic : Void*,   # HIC
    msg : UInt32,   # DWORD
    dw1 : LibC::SizeT,   # UINT_PTR
    dw2 : LibC::SizeT   # UINT_PTR
  ) : LibC::SSizeT
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef ICSendMessageNative = IntPtr Function(Pointer<Void>, Uint32, UintPtr, UintPtr);
typedef ICSendMessageDart = int Function(Pointer<Void>, int, int, int);
final ICSendMessage = DynamicLibrary.open('MSVFW32.dll')
    .lookupFunction<ICSendMessageNative, ICSendMessageDart>('ICSendMessage');
// hic : HIC -> Pointer<Void>
// msg : DWORD -> Uint32
// dw1 : UINT_PTR -> UintPtr
// dw2 : UINT_PTR -> UintPtr
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function ICSendMessage(
  hic: THandle;   // HIC
  msg: DWORD;   // DWORD
  dw1: NativeUInt;   // UINT_PTR
  dw2: NativeUInt   // UINT_PTR
): NativeInt; stdcall;
  external 'MSVFW32.dll' name 'ICSendMessage';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "ICSendMessage"
  c_ICSendMessage :: Ptr () -> Word32 -> CUIntPtr -> CUIntPtr -> IO CIntPtr
-- hic : HIC -> Ptr ()
-- msg : DWORD -> Word32
-- dw1 : UINT_PTR -> CUIntPtr
-- dw2 : UINT_PTR -> CUIntPtr
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let icsendmessage =
  foreign "ICSendMessage"
    ((ptr void) @-> uint32_t @-> size_t @-> size_t @-> returning intptr_t)
(* hic : HIC -> (ptr void) *)
(* msg : DWORD -> uint32_t *)
(* dw1 : UINT_PTR -> size_t *)
(* dw2 : UINT_PTR -> size_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library msvfw32 (t "MSVFW32.dll"))
(cffi:use-foreign-library msvfw32)

(cffi:defcfun ("ICSendMessage" icsend-message :convention :stdcall) :int64
  (hic :pointer)   ; HIC
  (msg :uint32)   ; DWORD
  (dw1 :uint64)   ; UINT_PTR
  (dw2 :uint64))   ; UINT_PTR
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $ICSendMessage = Win32::API::More->new('MSVFW32',
    'LPARAM ICSendMessage(HANDLE hic, DWORD msg, WPARAM dw1, WPARAM dw2)');
# my $ret = $ICSendMessage->Call($hic, $msg, $dw1, $dw2);
# hic : HIC -> HANDLE
# msg : DWORD -> DWORD
# dw1 : UINT_PTR -> WPARAM
# dw2 : UINT_PTR -> WPARAM
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。