ホーム › Media.Multimedia › ICGetDisplayFormat
ICGetDisplayFormat
関数表示に適した映像出力形式を取得する。
シグネチャ
// MSVFW32.dll
#include <windows.h>
HIC ICGetDisplayFormat(
HIC hic, // optional
BITMAPINFOHEADER* lpbiIn,
BITMAPINFOHEADER* lpbiOut,
INT BitDepth,
INT dx,
INT dy
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hic | HIC | inoptional |
| lpbiIn | BITMAPINFOHEADER* | in |
| lpbiOut | BITMAPINFOHEADER* | out |
| BitDepth | INT | in |
| dx | INT | in |
| dy | INT | in |
戻り値の型: HIC
各言語での呼び出し定義
// MSVFW32.dll
#include <windows.h>
HIC ICGetDisplayFormat(
HIC hic, // optional
BITMAPINFOHEADER* lpbiIn,
BITMAPINFOHEADER* lpbiOut,
INT BitDepth,
INT dx,
INT dy
);[DllImport("MSVFW32.dll", ExactSpelling = true)]
static extern IntPtr ICGetDisplayFormat(
IntPtr hic, // HIC optional
IntPtr lpbiIn, // BITMAPINFOHEADER*
IntPtr lpbiOut, // BITMAPINFOHEADER* out
int BitDepth, // INT
int dx, // INT
int dy // INT
);<DllImport("MSVFW32.dll", ExactSpelling:=True)>
Public Shared Function ICGetDisplayFormat(
hic As IntPtr, ' HIC optional
lpbiIn As IntPtr, ' BITMAPINFOHEADER*
lpbiOut As IntPtr, ' BITMAPINFOHEADER* out
BitDepth As Integer, ' INT
dx As Integer, ' INT
dy As Integer ' INT
) As IntPtr
End Function' hic : HIC optional
' lpbiIn : BITMAPINFOHEADER*
' lpbiOut : BITMAPINFOHEADER* out
' BitDepth : INT
' dx : INT
' dy : INT
Declare PtrSafe Function ICGetDisplayFormat Lib "msvfw32" ( _
ByVal hic As LongPtr, _
ByVal lpbiIn As LongPtr, _
ByVal lpbiOut As LongPtr, _
ByVal BitDepth As Long, _
ByVal dx As Long, _
ByVal dy As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ICGetDisplayFormat = ctypes.windll.msvfw32.ICGetDisplayFormat
ICGetDisplayFormat.restype = ctypes.c_void_p
ICGetDisplayFormat.argtypes = [
wintypes.HANDLE, # hic : HIC optional
ctypes.c_void_p, # lpbiIn : BITMAPINFOHEADER*
ctypes.c_void_p, # lpbiOut : BITMAPINFOHEADER* out
ctypes.c_int, # BitDepth : INT
ctypes.c_int, # dx : INT
ctypes.c_int, # dy : INT
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MSVFW32.dll')
ICGetDisplayFormat = Fiddle::Function.new(
lib['ICGetDisplayFormat'],
[
Fiddle::TYPE_VOIDP, # hic : HIC optional
Fiddle::TYPE_VOIDP, # lpbiIn : BITMAPINFOHEADER*
Fiddle::TYPE_VOIDP, # lpbiOut : BITMAPINFOHEADER* out
Fiddle::TYPE_INT, # BitDepth : INT
Fiddle::TYPE_INT, # dx : INT
Fiddle::TYPE_INT, # dy : INT
],
Fiddle::TYPE_VOIDP)#[link(name = "msvfw32")]
extern "system" {
fn ICGetDisplayFormat(
hic: *mut core::ffi::c_void, // HIC optional
lpbiIn: *mut BITMAPINFOHEADER, // BITMAPINFOHEADER*
lpbiOut: *mut BITMAPINFOHEADER, // BITMAPINFOHEADER* out
BitDepth: i32, // INT
dx: i32, // INT
dy: i32 // INT
) -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("MSVFW32.dll")]
public static extern IntPtr ICGetDisplayFormat(IntPtr hic, IntPtr lpbiIn, IntPtr lpbiOut, int BitDepth, int dx, int dy);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MSVFW32_ICGetDisplayFormat' -Namespace Win32 -PassThru
# $api::ICGetDisplayFormat(hic, lpbiIn, lpbiOut, BitDepth, dx, dy)#uselib "MSVFW32.dll"
#func global ICGetDisplayFormat "ICGetDisplayFormat" sptr, sptr, sptr, sptr, sptr, sptr
; ICGetDisplayFormat hic, varptr(lpbiIn), varptr(lpbiOut), BitDepth, dx, dy ; 戻り値は stat
; hic : HIC optional -> "sptr"
; lpbiIn : BITMAPINFOHEADER* -> "sptr"
; lpbiOut : BITMAPINFOHEADER* out -> "sptr"
; BitDepth : INT -> "sptr"
; dx : INT -> "sptr"
; dy : INT -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "MSVFW32.dll" #cfunc global ICGetDisplayFormat "ICGetDisplayFormat" sptr, var, var, int, int, int ; res = ICGetDisplayFormat(hic, lpbiIn, lpbiOut, BitDepth, dx, dy) ; hic : HIC optional -> "sptr" ; lpbiIn : BITMAPINFOHEADER* -> "var" ; lpbiOut : BITMAPINFOHEADER* out -> "var" ; BitDepth : INT -> "int" ; dx : INT -> "int" ; dy : INT -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "MSVFW32.dll" #cfunc global ICGetDisplayFormat "ICGetDisplayFormat" sptr, sptr, sptr, int, int, int ; res = ICGetDisplayFormat(hic, varptr(lpbiIn), varptr(lpbiOut), BitDepth, dx, dy) ; hic : HIC optional -> "sptr" ; lpbiIn : BITMAPINFOHEADER* -> "sptr" ; lpbiOut : BITMAPINFOHEADER* out -> "sptr" ; BitDepth : INT -> "int" ; dx : INT -> "int" ; dy : INT -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HIC ICGetDisplayFormat(HIC hic, BITMAPINFOHEADER* lpbiIn, BITMAPINFOHEADER* lpbiOut, INT BitDepth, INT dx, INT dy) #uselib "MSVFW32.dll" #cfunc global ICGetDisplayFormat "ICGetDisplayFormat" intptr, var, var, int, int, int ; res = ICGetDisplayFormat(hic, lpbiIn, lpbiOut, BitDepth, dx, dy) ; hic : HIC optional -> "intptr" ; lpbiIn : BITMAPINFOHEADER* -> "var" ; lpbiOut : BITMAPINFOHEADER* out -> "var" ; BitDepth : INT -> "int" ; dx : INT -> "int" ; dy : INT -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HIC ICGetDisplayFormat(HIC hic, BITMAPINFOHEADER* lpbiIn, BITMAPINFOHEADER* lpbiOut, INT BitDepth, INT dx, INT dy) #uselib "MSVFW32.dll" #cfunc global ICGetDisplayFormat "ICGetDisplayFormat" intptr, intptr, intptr, int, int, int ; res = ICGetDisplayFormat(hic, varptr(lpbiIn), varptr(lpbiOut), BitDepth, dx, dy) ; hic : HIC optional -> "intptr" ; lpbiIn : BITMAPINFOHEADER* -> "intptr" ; lpbiOut : BITMAPINFOHEADER* out -> "intptr" ; BitDepth : INT -> "int" ; dx : INT -> "int" ; dy : INT -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
msvfw32 = windows.NewLazySystemDLL("MSVFW32.dll")
procICGetDisplayFormat = msvfw32.NewProc("ICGetDisplayFormat")
)
// hic (HIC optional), lpbiIn (BITMAPINFOHEADER*), lpbiOut (BITMAPINFOHEADER* out), BitDepth (INT), dx (INT), dy (INT)
r1, _, err := procICGetDisplayFormat.Call(
uintptr(hic),
uintptr(lpbiIn),
uintptr(lpbiOut),
uintptr(BitDepth),
uintptr(dx),
uintptr(dy),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HICfunction ICGetDisplayFormat(
hic: THandle; // HIC optional
lpbiIn: Pointer; // BITMAPINFOHEADER*
lpbiOut: Pointer; // BITMAPINFOHEADER* out
BitDepth: Integer; // INT
dx: Integer; // INT
dy: Integer // INT
): THandle; stdcall;
external 'MSVFW32.dll' name 'ICGetDisplayFormat';result := DllCall("MSVFW32\ICGetDisplayFormat"
, "Ptr", hic ; HIC optional
, "Ptr", lpbiIn ; BITMAPINFOHEADER*
, "Ptr", lpbiOut ; BITMAPINFOHEADER* out
, "Int", BitDepth ; INT
, "Int", dx ; INT
, "Int", dy ; INT
, "Ptr") ; return: HIC●ICGetDisplayFormat(hic, lpbiIn, lpbiOut, BitDepth, dx, dy) = DLL("MSVFW32.dll", "void* ICGetDisplayFormat(void*, void*, void*, int, int, int)")
# 呼び出し: ICGetDisplayFormat(hic, lpbiIn, lpbiOut, BitDepth, dx, dy)
# hic : HIC optional -> "void*"
# lpbiIn : BITMAPINFOHEADER* -> "void*"
# lpbiOut : BITMAPINFOHEADER* out -> "void*"
# BitDepth : INT -> "int"
# dx : INT -> "int"
# dy : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。