ホーム › Graphics.Gdi › SetGraphicsMode
SetGraphicsMode
関数DCの図形モード(互換またはアドバンスト)を設定する。
シグネチャ
// GDI32.dll
#include <windows.h>
INT SetGraphicsMode(
HDC hdc,
GRAPHICS_MODE iMode
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hdc | HDC | in |
| iMode | GRAPHICS_MODE | in |
戻り値の型: INT
各言語での呼び出し定義
// GDI32.dll
#include <windows.h>
INT SetGraphicsMode(
HDC hdc,
GRAPHICS_MODE iMode
);[DllImport("GDI32.dll", ExactSpelling = true)]
static extern int SetGraphicsMode(
IntPtr hdc, // HDC
int iMode // GRAPHICS_MODE
);<DllImport("GDI32.dll", ExactSpelling:=True)>
Public Shared Function SetGraphicsMode(
hdc As IntPtr, ' HDC
iMode As Integer ' GRAPHICS_MODE
) As Integer
End Function' hdc : HDC
' iMode : GRAPHICS_MODE
Declare PtrSafe Function SetGraphicsMode Lib "gdi32" ( _
ByVal hdc As LongPtr, _
ByVal iMode As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SetGraphicsMode = ctypes.windll.gdi32.SetGraphicsMode
SetGraphicsMode.restype = ctypes.c_int
SetGraphicsMode.argtypes = [
wintypes.HANDLE, # hdc : HDC
ctypes.c_int, # iMode : GRAPHICS_MODE
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('GDI32.dll')
SetGraphicsMode = Fiddle::Function.new(
lib['SetGraphicsMode'],
[
Fiddle::TYPE_VOIDP, # hdc : HDC
Fiddle::TYPE_INT, # iMode : GRAPHICS_MODE
],
Fiddle::TYPE_INT)#[link(name = "gdi32")]
extern "system" {
fn SetGraphicsMode(
hdc: *mut core::ffi::c_void, // HDC
iMode: i32 // GRAPHICS_MODE
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("GDI32.dll")]
public static extern int SetGraphicsMode(IntPtr hdc, int iMode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GDI32_SetGraphicsMode' -Namespace Win32 -PassThru
# $api::SetGraphicsMode(hdc, iMode)#uselib "GDI32.dll"
#func global SetGraphicsMode "SetGraphicsMode" sptr, sptr
; SetGraphicsMode hdc, iMode ; 戻り値は stat
; hdc : HDC -> "sptr"
; iMode : GRAPHICS_MODE -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "GDI32.dll"
#cfunc global SetGraphicsMode "SetGraphicsMode" sptr, int
; res = SetGraphicsMode(hdc, iMode)
; hdc : HDC -> "sptr"
; iMode : GRAPHICS_MODE -> "int"; INT SetGraphicsMode(HDC hdc, GRAPHICS_MODE iMode)
#uselib "GDI32.dll"
#cfunc global SetGraphicsMode "SetGraphicsMode" intptr, int
; res = SetGraphicsMode(hdc, iMode)
; hdc : HDC -> "intptr"
; iMode : GRAPHICS_MODE -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdi32 = windows.NewLazySystemDLL("GDI32.dll")
procSetGraphicsMode = gdi32.NewProc("SetGraphicsMode")
)
// hdc (HDC), iMode (GRAPHICS_MODE)
r1, _, err := procSetGraphicsMode.Call(
uintptr(hdc),
uintptr(iMode),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction SetGraphicsMode(
hdc: THandle; // HDC
iMode: Integer // GRAPHICS_MODE
): Integer; stdcall;
external 'GDI32.dll' name 'SetGraphicsMode';result := DllCall("GDI32\SetGraphicsMode"
, "Ptr", hdc ; HDC
, "Int", iMode ; GRAPHICS_MODE
, "Int") ; return: INT●SetGraphicsMode(hdc, iMode) = DLL("GDI32.dll", "int SetGraphicsMode(void*, int)")
# 呼び出し: SetGraphicsMode(hdc, iMode)
# hdc : HDC -> "void*"
# iMode : GRAPHICS_MODE -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。