ホーム › Graphics.Gdi › ResetDCW
ResetDCW
関数DEVMODE指定でデバイスコンテキストを再設定する。
シグネチャ
// GDI32.dll (Unicode / -W)
#include <windows.h>
HDC ResetDCW(
HDC hdc,
const DEVMODEW* lpdm
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hdc | HDC | in |
| lpdm | DEVMODEW* | in |
戻り値の型: HDC
各言語での呼び出し定義
// GDI32.dll (Unicode / -W)
#include <windows.h>
HDC ResetDCW(
HDC hdc,
const DEVMODEW* lpdm
);[DllImport("GDI32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern IntPtr ResetDCW(
IntPtr hdc, // HDC
IntPtr lpdm // DEVMODEW*
);<DllImport("GDI32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function ResetDCW(
hdc As IntPtr, ' HDC
lpdm As IntPtr ' DEVMODEW*
) As IntPtr
End Function' hdc : HDC
' lpdm : DEVMODEW*
Declare PtrSafe Function ResetDCW Lib "gdi32" ( _
ByVal hdc As LongPtr, _
ByVal lpdm As LongPtr) As LongPtr
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ResetDCW = ctypes.windll.gdi32.ResetDCW
ResetDCW.restype = ctypes.c_void_p
ResetDCW.argtypes = [
wintypes.HANDLE, # hdc : HDC
ctypes.c_void_p, # lpdm : DEVMODEW*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('GDI32.dll')
ResetDCW = Fiddle::Function.new(
lib['ResetDCW'],
[
Fiddle::TYPE_VOIDP, # hdc : HDC
Fiddle::TYPE_VOIDP, # lpdm : DEVMODEW*
],
Fiddle::TYPE_VOIDP)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "gdi32")]
extern "system" {
fn ResetDCW(
hdc: *mut core::ffi::c_void, // HDC
lpdm: *const DEVMODEW // DEVMODEW*
) -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("GDI32.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr ResetDCW(IntPtr hdc, IntPtr lpdm);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GDI32_ResetDCW' -Namespace Win32 -PassThru
# $api::ResetDCW(hdc, lpdm)#uselib "GDI32.dll"
#func global ResetDCW "ResetDCW" wptr, wptr
; ResetDCW hdc, varptr(lpdm) ; 戻り値は stat
; hdc : HDC -> "wptr"
; lpdm : DEVMODEW* -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "GDI32.dll" #cfunc global ResetDCW "ResetDCW" sptr, var ; res = ResetDCW(hdc, lpdm) ; hdc : HDC -> "sptr" ; lpdm : DEVMODEW* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "GDI32.dll" #cfunc global ResetDCW "ResetDCW" sptr, sptr ; res = ResetDCW(hdc, varptr(lpdm)) ; hdc : HDC -> "sptr" ; lpdm : DEVMODEW* -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HDC ResetDCW(HDC hdc, DEVMODEW* lpdm) #uselib "GDI32.dll" #cfunc global ResetDCW "ResetDCW" intptr, var ; res = ResetDCW(hdc, lpdm) ; hdc : HDC -> "intptr" ; lpdm : DEVMODEW* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HDC ResetDCW(HDC hdc, DEVMODEW* lpdm) #uselib "GDI32.dll" #cfunc global ResetDCW "ResetDCW" intptr, intptr ; res = ResetDCW(hdc, varptr(lpdm)) ; hdc : HDC -> "intptr" ; lpdm : DEVMODEW* -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdi32 = windows.NewLazySystemDLL("GDI32.dll")
procResetDCW = gdi32.NewProc("ResetDCW")
)
// hdc (HDC), lpdm (DEVMODEW*)
r1, _, err := procResetDCW.Call(
uintptr(hdc),
uintptr(lpdm),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HDCfunction ResetDCW(
hdc: THandle; // HDC
lpdm: Pointer // DEVMODEW*
): THandle; stdcall;
external 'GDI32.dll' name 'ResetDCW';result := DllCall("GDI32\ResetDCW"
, "Ptr", hdc ; HDC
, "Ptr", lpdm ; DEVMODEW*
, "Ptr") ; return: HDC●ResetDCW(hdc, lpdm) = DLL("GDI32.dll", "void* ResetDCW(void*, void*)")
# 呼び出し: ResetDCW(hdc, lpdm)
# hdc : HDC -> "void*"
# lpdm : DEVMODEW* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。