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