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