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

各言語での呼び出し定義

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