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