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

戻り値の型: HRESULT

各言語での呼び出し定義

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