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

MFCreateRelativePanelWatcher

関数
ビデオデバイスと表示モニターの相対パネル位置監視を生成する。
DLLMFSENSORGROUP.dll呼出規約winapi対応OSWindows 10 以降

シグネチャ

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

HRESULT MFCreateRelativePanelWatcher(
    LPCWSTR videoDeviceId,
    LPCWSTR displayMonitorDeviceId,
    IMFRelativePanelWatcher** ppRelativePanelWatcher
);

パラメーター

名前方向説明
videoDeviceIdLPCWSTRinビデオキャプチャデバイスのシンボリックリンク名を含む文字列。
displayMonitorDeviceIdLPCWSTRinディスプレイモニターデバイスのシンボリックリンク名を含む文字列。
ppRelativePanelWatcherIMFRelativePanelWatcher**outウォッチャーを表す IMFRelativePanelWatcher インターフェイスへのポインター。

戻り値の型: HRESULT

公式ドキュメント

IMFRelativePanelWatcher インターフェイスの新しいインスタンスを作成します。

戻り値

この関数は HRESULT を返します。指定可能な値には、以下の表に示すものが含まれますが、これらに限定されません。

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

各言語での呼び出し定義

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

HRESULT MFCreateRelativePanelWatcher(
    LPCWSTR videoDeviceId,
    LPCWSTR displayMonitorDeviceId,
    IMFRelativePanelWatcher** ppRelativePanelWatcher
);
[DllImport("MFSENSORGROUP.dll", ExactSpelling = true)]
static extern int MFCreateRelativePanelWatcher(
    [MarshalAs(UnmanagedType.LPWStr)] string videoDeviceId,   // LPCWSTR
    [MarshalAs(UnmanagedType.LPWStr)] string displayMonitorDeviceId,   // LPCWSTR
    IntPtr ppRelativePanelWatcher   // IMFRelativePanelWatcher** out
);
<DllImport("MFSENSORGROUP.dll", ExactSpelling:=True)>
Public Shared Function MFCreateRelativePanelWatcher(
    <MarshalAs(UnmanagedType.LPWStr)> videoDeviceId As String,   ' LPCWSTR
    <MarshalAs(UnmanagedType.LPWStr)> displayMonitorDeviceId As String,   ' LPCWSTR
    ppRelativePanelWatcher As IntPtr   ' IMFRelativePanelWatcher** out
) As Integer
End Function
' videoDeviceId : LPCWSTR
' displayMonitorDeviceId : LPCWSTR
' ppRelativePanelWatcher : IMFRelativePanelWatcher** out
Declare PtrSafe Function MFCreateRelativePanelWatcher Lib "mfsensorgroup" ( _
    ByVal videoDeviceId As LongPtr, _
    ByVal displayMonitorDeviceId As LongPtr, _
    ByVal ppRelativePanelWatcher As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MFCreateRelativePanelWatcher = ctypes.windll.mfsensorgroup.MFCreateRelativePanelWatcher
MFCreateRelativePanelWatcher.restype = ctypes.c_int
MFCreateRelativePanelWatcher.argtypes = [
    wintypes.LPCWSTR,  # videoDeviceId : LPCWSTR
    wintypes.LPCWSTR,  # displayMonitorDeviceId : LPCWSTR
    ctypes.c_void_p,  # ppRelativePanelWatcher : IMFRelativePanelWatcher** out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MFSENSORGROUP.dll')
MFCreateRelativePanelWatcher = Fiddle::Function.new(
  lib['MFCreateRelativePanelWatcher'],
  [
    Fiddle::TYPE_VOIDP,  # videoDeviceId : LPCWSTR
    Fiddle::TYPE_VOIDP,  # displayMonitorDeviceId : LPCWSTR
    Fiddle::TYPE_VOIDP,  # ppRelativePanelWatcher : IMFRelativePanelWatcher** out
  ],
  Fiddle::TYPE_INT)
#[link(name = "mfsensorgroup")]
extern "system" {
    fn MFCreateRelativePanelWatcher(
        videoDeviceId: *const u16,  // LPCWSTR
        displayMonitorDeviceId: *const u16,  // LPCWSTR
        ppRelativePanelWatcher: *mut *mut core::ffi::c_void  // IMFRelativePanelWatcher** out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("MFSENSORGROUP.dll")]
public static extern int MFCreateRelativePanelWatcher([MarshalAs(UnmanagedType.LPWStr)] string videoDeviceId, [MarshalAs(UnmanagedType.LPWStr)] string displayMonitorDeviceId, IntPtr ppRelativePanelWatcher);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MFSENSORGROUP_MFCreateRelativePanelWatcher' -Namespace Win32 -PassThru
# $api::MFCreateRelativePanelWatcher(videoDeviceId, displayMonitorDeviceId, ppRelativePanelWatcher)
#uselib "MFSENSORGROUP.dll"
#func global MFCreateRelativePanelWatcher "MFCreateRelativePanelWatcher" sptr, sptr, sptr
; MFCreateRelativePanelWatcher videoDeviceId, displayMonitorDeviceId, ppRelativePanelWatcher   ; 戻り値は stat
; videoDeviceId : LPCWSTR -> "sptr"
; displayMonitorDeviceId : LPCWSTR -> "sptr"
; ppRelativePanelWatcher : IMFRelativePanelWatcher** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "MFSENSORGROUP.dll"
#cfunc global MFCreateRelativePanelWatcher "MFCreateRelativePanelWatcher" wstr, wstr, sptr
; res = MFCreateRelativePanelWatcher(videoDeviceId, displayMonitorDeviceId, ppRelativePanelWatcher)
; videoDeviceId : LPCWSTR -> "wstr"
; displayMonitorDeviceId : LPCWSTR -> "wstr"
; ppRelativePanelWatcher : IMFRelativePanelWatcher** out -> "sptr"
; HRESULT MFCreateRelativePanelWatcher(LPCWSTR videoDeviceId, LPCWSTR displayMonitorDeviceId, IMFRelativePanelWatcher** ppRelativePanelWatcher)
#uselib "MFSENSORGROUP.dll"
#cfunc global MFCreateRelativePanelWatcher "MFCreateRelativePanelWatcher" wstr, wstr, intptr
; res = MFCreateRelativePanelWatcher(videoDeviceId, displayMonitorDeviceId, ppRelativePanelWatcher)
; videoDeviceId : LPCWSTR -> "wstr"
; displayMonitorDeviceId : LPCWSTR -> "wstr"
; ppRelativePanelWatcher : IMFRelativePanelWatcher** out -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mfsensorgroup = windows.NewLazySystemDLL("MFSENSORGROUP.dll")
	procMFCreateRelativePanelWatcher = mfsensorgroup.NewProc("MFCreateRelativePanelWatcher")
)

// videoDeviceId (LPCWSTR), displayMonitorDeviceId (LPCWSTR), ppRelativePanelWatcher (IMFRelativePanelWatcher** out)
r1, _, err := procMFCreateRelativePanelWatcher.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(videoDeviceId))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(displayMonitorDeviceId))),
	uintptr(ppRelativePanelWatcher),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function MFCreateRelativePanelWatcher(
  videoDeviceId: PWideChar;   // LPCWSTR
  displayMonitorDeviceId: PWideChar;   // LPCWSTR
  ppRelativePanelWatcher: Pointer   // IMFRelativePanelWatcher** out
): Integer; stdcall;
  external 'MFSENSORGROUP.dll' name 'MFCreateRelativePanelWatcher';
result := DllCall("MFSENSORGROUP\MFCreateRelativePanelWatcher"
    , "WStr", videoDeviceId   ; LPCWSTR
    , "WStr", displayMonitorDeviceId   ; LPCWSTR
    , "Ptr", ppRelativePanelWatcher   ; IMFRelativePanelWatcher** out
    , "Int")   ; return: HRESULT
●MFCreateRelativePanelWatcher(videoDeviceId, displayMonitorDeviceId, ppRelativePanelWatcher) = DLL("MFSENSORGROUP.dll", "int MFCreateRelativePanelWatcher(char*, char*, void*)")
# 呼び出し: MFCreateRelativePanelWatcher(videoDeviceId, displayMonitorDeviceId, ppRelativePanelWatcher)
# videoDeviceId : LPCWSTR -> "char*"
# displayMonitorDeviceId : LPCWSTR -> "char*"
# ppRelativePanelWatcher : IMFRelativePanelWatcher** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "mfsensorgroup" fn MFCreateRelativePanelWatcher(
    videoDeviceId: [*c]const u16, // LPCWSTR
    displayMonitorDeviceId: [*c]const u16, // LPCWSTR
    ppRelativePanelWatcher: ?*anyopaque // IMFRelativePanelWatcher** out
) callconv(std.os.windows.WINAPI) i32;
proc MFCreateRelativePanelWatcher(
    videoDeviceId: WideCString,  # LPCWSTR
    displayMonitorDeviceId: WideCString,  # LPCWSTR
    ppRelativePanelWatcher: pointer  # IMFRelativePanelWatcher** out
): int32 {.importc: "MFCreateRelativePanelWatcher", stdcall, dynlib: "MFSENSORGROUP.dll".}
pragma(lib, "mfsensorgroup");
extern(Windows)
int MFCreateRelativePanelWatcher(
    const(wchar)* videoDeviceId,   // LPCWSTR
    const(wchar)* displayMonitorDeviceId,   // LPCWSTR
    void* ppRelativePanelWatcher   // IMFRelativePanelWatcher** out
);
ccall((:MFCreateRelativePanelWatcher, "MFSENSORGROUP.dll"), stdcall, Int32,
      (Cwstring, Cwstring, Ptr{Cvoid}),
      videoDeviceId, displayMonitorDeviceId, ppRelativePanelWatcher)
# videoDeviceId : LPCWSTR -> Cwstring
# displayMonitorDeviceId : LPCWSTR -> Cwstring
# ppRelativePanelWatcher : IMFRelativePanelWatcher** out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t MFCreateRelativePanelWatcher(
    const uint16_t* videoDeviceId,
    const uint16_t* displayMonitorDeviceId,
    void* ppRelativePanelWatcher);
]]
local mfsensorgroup = ffi.load("mfsensorgroup")
-- mfsensorgroup.MFCreateRelativePanelWatcher(videoDeviceId, displayMonitorDeviceId, ppRelativePanelWatcher)
-- videoDeviceId : LPCWSTR
-- displayMonitorDeviceId : LPCWSTR
-- ppRelativePanelWatcher : IMFRelativePanelWatcher** out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('MFSENSORGROUP.dll');
const MFCreateRelativePanelWatcher = lib.func('__stdcall', 'MFCreateRelativePanelWatcher', 'int32_t', ['str16', 'str16', 'void *']);
// MFCreateRelativePanelWatcher(videoDeviceId, displayMonitorDeviceId, ppRelativePanelWatcher)
// videoDeviceId : LPCWSTR -> 'str16'
// displayMonitorDeviceId : LPCWSTR -> 'str16'
// ppRelativePanelWatcher : IMFRelativePanelWatcher** out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("MFSENSORGROUP.dll", {
  MFCreateRelativePanelWatcher: { parameters: ["buffer", "buffer", "pointer"], result: "i32" },
});
// lib.symbols.MFCreateRelativePanelWatcher(videoDeviceId, displayMonitorDeviceId, ppRelativePanelWatcher)
// videoDeviceId : LPCWSTR -> "buffer"
// displayMonitorDeviceId : LPCWSTR -> "buffer"
// ppRelativePanelWatcher : IMFRelativePanelWatcher** out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t MFCreateRelativePanelWatcher(
    const uint16_t* videoDeviceId,
    const uint16_t* displayMonitorDeviceId,
    void* ppRelativePanelWatcher);
C, "MFSENSORGROUP.dll");
// $ffi->MFCreateRelativePanelWatcher(videoDeviceId, displayMonitorDeviceId, ppRelativePanelWatcher);
// videoDeviceId : LPCWSTR
// displayMonitorDeviceId : LPCWSTR
// ppRelativePanelWatcher : IMFRelativePanelWatcher** out
// 構造体/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 Mfsensorgroup extends StdCallLibrary {
    Mfsensorgroup INSTANCE = Native.load("mfsensorgroup", Mfsensorgroup.class);
    int MFCreateRelativePanelWatcher(
        WString videoDeviceId,   // LPCWSTR
        WString displayMonitorDeviceId,   // LPCWSTR
        Pointer ppRelativePanelWatcher   // IMFRelativePanelWatcher** out
    );
}
@[Link("mfsensorgroup")]
lib LibMFSENSORGROUP
  fun MFCreateRelativePanelWatcher = MFCreateRelativePanelWatcher(
    videoDeviceId : UInt16*,   # LPCWSTR
    displayMonitorDeviceId : UInt16*,   # LPCWSTR
    ppRelativePanelWatcher : Void*   # IMFRelativePanelWatcher** out
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef MFCreateRelativePanelWatcherNative = Int32 Function(Pointer<Utf16>, Pointer<Utf16>, Pointer<Void>);
typedef MFCreateRelativePanelWatcherDart = int Function(Pointer<Utf16>, Pointer<Utf16>, Pointer<Void>);
final MFCreateRelativePanelWatcher = DynamicLibrary.open('MFSENSORGROUP.dll')
    .lookupFunction<MFCreateRelativePanelWatcherNative, MFCreateRelativePanelWatcherDart>('MFCreateRelativePanelWatcher');
// videoDeviceId : LPCWSTR -> Pointer<Utf16>
// displayMonitorDeviceId : LPCWSTR -> Pointer<Utf16>
// ppRelativePanelWatcher : IMFRelativePanelWatcher** out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function MFCreateRelativePanelWatcher(
  videoDeviceId: PWideChar;   // LPCWSTR
  displayMonitorDeviceId: PWideChar;   // LPCWSTR
  ppRelativePanelWatcher: Pointer   // IMFRelativePanelWatcher** out
): Integer; stdcall;
  external 'MFSENSORGROUP.dll' name 'MFCreateRelativePanelWatcher';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "MFCreateRelativePanelWatcher"
  c_MFCreateRelativePanelWatcher :: CWString -> CWString -> Ptr () -> IO Int32
-- videoDeviceId : LPCWSTR -> CWString
-- displayMonitorDeviceId : LPCWSTR -> CWString
-- ppRelativePanelWatcher : IMFRelativePanelWatcher** out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let mfcreaterelativepanelwatcher =
  foreign "MFCreateRelativePanelWatcher"
    ((ptr uint16_t) @-> (ptr uint16_t) @-> (ptr void) @-> returning int32_t)
(* videoDeviceId : LPCWSTR -> (ptr uint16_t) *)
(* displayMonitorDeviceId : LPCWSTR -> (ptr uint16_t) *)
(* ppRelativePanelWatcher : IMFRelativePanelWatcher** out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library mfsensorgroup (t "MFSENSORGROUP.dll"))
(cffi:use-foreign-library mfsensorgroup)

(cffi:defcfun ("MFCreateRelativePanelWatcher" mfcreate-relative-panel-watcher :convention :stdcall) :int32
  (video-device-id (:string :encoding :utf-16le))   ; LPCWSTR
  (display-monitor-device-id (:string :encoding :utf-16le))   ; LPCWSTR
  (pp-relative-panel-watcher :pointer))   ; IMFRelativePanelWatcher** out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $MFCreateRelativePanelWatcher = Win32::API::More->new('MFSENSORGROUP',
    'int MFCreateRelativePanelWatcher(LPCWSTR videoDeviceId, LPCWSTR displayMonitorDeviceId, LPVOID ppRelativePanelWatcher)');
# my $ret = $MFCreateRelativePanelWatcher->Call($videoDeviceId, $displayMonitorDeviceId, $ppRelativePanelWatcher);
# videoDeviceId : LPCWSTR -> LPCWSTR
# displayMonitorDeviceId : LPCWSTR -> LPCWSTR
# ppRelativePanelWatcher : IMFRelativePanelWatcher** out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型