ホーム › Media.MediaFoundation › MFCreateSensorProfile
MFCreateSensorProfile
関数プロファイル種別と制約からセンサープロファイルを生成する。
シグネチャ
// MFSENSORGROUP.dll
#include <windows.h>
HRESULT MFCreateSensorProfile(
const GUID* ProfileType,
DWORD ProfileIndex,
LPCWSTR Constraints, // optional
IMFSensorProfile** ppProfile
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| ProfileType | GUID* | in | センサープロファイルの種別を示す GUID への参照。 |
| ProfileIndex | DWORD | in | 同一種別内でプロファイルを区別するインデックス。 |
| Constraints | LPCWSTR | inoptional | プロファイルの制約条件を表すワイド文字列。NULL 可。 |
| ppProfile | IMFSensorProfile** | out | 生成された IMFSensorProfile を受け取る出力ポインタ。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// MFSENSORGROUP.dll
#include <windows.h>
HRESULT MFCreateSensorProfile(
const GUID* ProfileType,
DWORD ProfileIndex,
LPCWSTR Constraints, // optional
IMFSensorProfile** ppProfile
);[DllImport("MFSENSORGROUP.dll", ExactSpelling = true)]
static extern int MFCreateSensorProfile(
ref Guid ProfileType, // GUID*
uint ProfileIndex, // DWORD
[MarshalAs(UnmanagedType.LPWStr)] string Constraints, // LPCWSTR optional
IntPtr ppProfile // IMFSensorProfile** out
);<DllImport("MFSENSORGROUP.dll", ExactSpelling:=True)>
Public Shared Function MFCreateSensorProfile(
ByRef ProfileType As Guid, ' GUID*
ProfileIndex As UInteger, ' DWORD
<MarshalAs(UnmanagedType.LPWStr)> Constraints As String, ' LPCWSTR optional
ppProfile As IntPtr ' IMFSensorProfile** out
) As Integer
End Function' ProfileType : GUID*
' ProfileIndex : DWORD
' Constraints : LPCWSTR optional
' ppProfile : IMFSensorProfile** out
Declare PtrSafe Function MFCreateSensorProfile Lib "mfsensorgroup" ( _
ByVal ProfileType As LongPtr, _
ByVal ProfileIndex As Long, _
ByVal Constraints As LongPtr, _
ByVal ppProfile As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
MFCreateSensorProfile = ctypes.windll.mfsensorgroup.MFCreateSensorProfile
MFCreateSensorProfile.restype = ctypes.c_int
MFCreateSensorProfile.argtypes = [
ctypes.c_void_p, # ProfileType : GUID*
wintypes.DWORD, # ProfileIndex : DWORD
wintypes.LPCWSTR, # Constraints : LPCWSTR optional
ctypes.c_void_p, # ppProfile : IMFSensorProfile** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MFSENSORGROUP.dll')
MFCreateSensorProfile = Fiddle::Function.new(
lib['MFCreateSensorProfile'],
[
Fiddle::TYPE_VOIDP, # ProfileType : GUID*
-Fiddle::TYPE_INT, # ProfileIndex : DWORD
Fiddle::TYPE_VOIDP, # Constraints : LPCWSTR optional
Fiddle::TYPE_VOIDP, # ppProfile : IMFSensorProfile** out
],
Fiddle::TYPE_INT)#[link(name = "mfsensorgroup")]
extern "system" {
fn MFCreateSensorProfile(
ProfileType: *const GUID, // GUID*
ProfileIndex: u32, // DWORD
Constraints: *const u16, // LPCWSTR optional
ppProfile: *mut *mut core::ffi::c_void // IMFSensorProfile** out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("MFSENSORGROUP.dll")]
public static extern int MFCreateSensorProfile(ref Guid ProfileType, uint ProfileIndex, [MarshalAs(UnmanagedType.LPWStr)] string Constraints, IntPtr ppProfile);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MFSENSORGROUP_MFCreateSensorProfile' -Namespace Win32 -PassThru
# $api::MFCreateSensorProfile(ProfileType, ProfileIndex, Constraints, ppProfile)#uselib "MFSENSORGROUP.dll"
#func global MFCreateSensorProfile "MFCreateSensorProfile" sptr, sptr, sptr, sptr
; MFCreateSensorProfile varptr(ProfileType), ProfileIndex, Constraints, ppProfile ; 戻り値は stat
; ProfileType : GUID* -> "sptr"
; ProfileIndex : DWORD -> "sptr"
; Constraints : LPCWSTR optional -> "sptr"
; ppProfile : IMFSensorProfile** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "MFSENSORGROUP.dll" #cfunc global MFCreateSensorProfile "MFCreateSensorProfile" var, int, wstr, sptr ; res = MFCreateSensorProfile(ProfileType, ProfileIndex, Constraints, ppProfile) ; ProfileType : GUID* -> "var" ; ProfileIndex : DWORD -> "int" ; Constraints : LPCWSTR optional -> "wstr" ; ppProfile : IMFSensorProfile** out -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "MFSENSORGROUP.dll" #cfunc global MFCreateSensorProfile "MFCreateSensorProfile" sptr, int, wstr, sptr ; res = MFCreateSensorProfile(varptr(ProfileType), ProfileIndex, Constraints, ppProfile) ; ProfileType : GUID* -> "sptr" ; ProfileIndex : DWORD -> "int" ; Constraints : LPCWSTR optional -> "wstr" ; ppProfile : IMFSensorProfile** out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT MFCreateSensorProfile(GUID* ProfileType, DWORD ProfileIndex, LPCWSTR Constraints, IMFSensorProfile** ppProfile) #uselib "MFSENSORGROUP.dll" #cfunc global MFCreateSensorProfile "MFCreateSensorProfile" var, int, wstr, intptr ; res = MFCreateSensorProfile(ProfileType, ProfileIndex, Constraints, ppProfile) ; ProfileType : GUID* -> "var" ; ProfileIndex : DWORD -> "int" ; Constraints : LPCWSTR optional -> "wstr" ; ppProfile : IMFSensorProfile** out -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT MFCreateSensorProfile(GUID* ProfileType, DWORD ProfileIndex, LPCWSTR Constraints, IMFSensorProfile** ppProfile) #uselib "MFSENSORGROUP.dll" #cfunc global MFCreateSensorProfile "MFCreateSensorProfile" intptr, int, wstr, intptr ; res = MFCreateSensorProfile(varptr(ProfileType), ProfileIndex, Constraints, ppProfile) ; ProfileType : GUID* -> "intptr" ; ProfileIndex : DWORD -> "int" ; Constraints : LPCWSTR optional -> "wstr" ; ppProfile : IMFSensorProfile** out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
mfsensorgroup = windows.NewLazySystemDLL("MFSENSORGROUP.dll")
procMFCreateSensorProfile = mfsensorgroup.NewProc("MFCreateSensorProfile")
)
// ProfileType (GUID*), ProfileIndex (DWORD), Constraints (LPCWSTR optional), ppProfile (IMFSensorProfile** out)
r1, _, err := procMFCreateSensorProfile.Call(
uintptr(ProfileType),
uintptr(ProfileIndex),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(Constraints))),
uintptr(ppProfile),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction MFCreateSensorProfile(
ProfileType: PGUID; // GUID*
ProfileIndex: DWORD; // DWORD
Constraints: PWideChar; // LPCWSTR optional
ppProfile: Pointer // IMFSensorProfile** out
): Integer; stdcall;
external 'MFSENSORGROUP.dll' name 'MFCreateSensorProfile';result := DllCall("MFSENSORGROUP\MFCreateSensorProfile"
, "Ptr", ProfileType ; GUID*
, "UInt", ProfileIndex ; DWORD
, "WStr", Constraints ; LPCWSTR optional
, "Ptr", ppProfile ; IMFSensorProfile** out
, "Int") ; return: HRESULT●MFCreateSensorProfile(ProfileType, ProfileIndex, Constraints, ppProfile) = DLL("MFSENSORGROUP.dll", "int MFCreateSensorProfile(void*, dword, char*, void*)")
# 呼び出し: MFCreateSensorProfile(ProfileType, ProfileIndex, Constraints, ppProfile)
# ProfileType : GUID* -> "void*"
# ProfileIndex : DWORD -> "dword"
# Constraints : LPCWSTR optional -> "char*"
# ppProfile : IMFSensorProfile** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。