Win32 API 日本語リファレンス
ホームDevices.Display › DegaussMonitor

DegaussMonitor

関数
CRTモニタを消磁(デガウス)する。
DLLdxva2.dll呼出規約winapiSetLastErrorあり対応OSWindows Vista 以降

シグネチャ

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

INT DegaussMonitor(
    HANDLE hMonitor
);

パラメーター

名前方向
hMonitorHANDLEin

戻り値の型: INT

各言語での呼び出し定義

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

INT DegaussMonitor(
    HANDLE hMonitor
);
[DllImport("dxva2.dll", SetLastError = true, ExactSpelling = true)]
static extern int DegaussMonitor(
    IntPtr hMonitor   // HANDLE
);
<DllImport("dxva2.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function DegaussMonitor(
    hMonitor As IntPtr   ' HANDLE
) As Integer
End Function
' hMonitor : HANDLE
Declare PtrSafe Function DegaussMonitor Lib "dxva2" ( _
    ByVal hMonitor As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

DegaussMonitor = ctypes.windll.dxva2.DegaussMonitor
DegaussMonitor.restype = ctypes.c_int
DegaussMonitor.argtypes = [
    wintypes.HANDLE,  # hMonitor : HANDLE
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('dxva2.dll')
DegaussMonitor = Fiddle::Function.new(
  lib['DegaussMonitor'],
  [
    Fiddle::TYPE_VOIDP,  # hMonitor : HANDLE
  ],
  Fiddle::TYPE_INT)
#[link(name = "dxva2")]
extern "system" {
    fn DegaussMonitor(
        hMonitor: *mut core::ffi::c_void  // HANDLE
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("dxva2.dll", SetLastError = true)]
public static extern int DegaussMonitor(IntPtr hMonitor);
"@
$api = Add-Type -MemberDefinition $sig -Name 'dxva2_DegaussMonitor' -Namespace Win32 -PassThru
# $api::DegaussMonitor(hMonitor)
#uselib "dxva2.dll"
#func global DegaussMonitor "DegaussMonitor" sptr
; DegaussMonitor hMonitor   ; 戻り値は stat
; hMonitor : HANDLE -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "dxva2.dll"
#cfunc global DegaussMonitor "DegaussMonitor" sptr
; res = DegaussMonitor(hMonitor)
; hMonitor : HANDLE -> "sptr"
; INT DegaussMonitor(HANDLE hMonitor)
#uselib "dxva2.dll"
#cfunc global DegaussMonitor "DegaussMonitor" intptr
; res = DegaussMonitor(hMonitor)
; hMonitor : HANDLE -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	dxva2 = windows.NewLazySystemDLL("dxva2.dll")
	procDegaussMonitor = dxva2.NewProc("DegaussMonitor")
)

// hMonitor (HANDLE)
r1, _, err := procDegaussMonitor.Call(
	uintptr(hMonitor),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function DegaussMonitor(
  hMonitor: THandle   // HANDLE
): Integer; stdcall;
  external 'dxva2.dll' name 'DegaussMonitor';
result := DllCall("dxva2\DegaussMonitor"
    , "Ptr", hMonitor   ; HANDLE
    , "Int")   ; return: INT
●DegaussMonitor(hMonitor) = DLL("dxva2.dll", "int DegaussMonitor(void*)")
# 呼び出し: DegaussMonitor(hMonitor)
# hMonitor : HANDLE -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。