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