Win32 API 日本語リファレンス
ホームGraphics.GdiPlus › GdipGetHatchForegroundColor

GdipGetHatchForegroundColor

関数
ハッチブラシの前景色を取得する。
DLLgdiplus.dll呼出規約winapi

シグネチャ

// gdiplus.dll
#include <windows.h>

Status GdipGetHatchForegroundColor(
    GpHatch* brush,
    DWORD* forecol
);

パラメーター

名前方向
brushGpHatch*inout
forecolDWORD*inout

戻り値の型: Status

各言語での呼び出し定義

// gdiplus.dll
#include <windows.h>

Status GdipGetHatchForegroundColor(
    GpHatch* brush,
    DWORD* forecol
);
[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipGetHatchForegroundColor(
    IntPtr brush,   // GpHatch* in/out
    ref uint forecol   // DWORD* in/out
);
<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipGetHatchForegroundColor(
    brush As IntPtr,   ' GpHatch* in/out
    ByRef forecol As UInteger   ' DWORD* in/out
) As Integer
End Function
' brush : GpHatch* in/out
' forecol : DWORD* in/out
Declare PtrSafe Function GdipGetHatchForegroundColor Lib "gdiplus" ( _
    ByVal brush As LongPtr, _
    ByRef forecol As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GdipGetHatchForegroundColor = ctypes.windll.gdiplus.GdipGetHatchForegroundColor
GdipGetHatchForegroundColor.restype = ctypes.c_int
GdipGetHatchForegroundColor.argtypes = [
    ctypes.c_void_p,  # brush : GpHatch* in/out
    ctypes.POINTER(wintypes.DWORD),  # forecol : DWORD* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('gdiplus.dll')
GdipGetHatchForegroundColor = Fiddle::Function.new(
  lib['GdipGetHatchForegroundColor'],
  [
    Fiddle::TYPE_VOIDP,  # brush : GpHatch* in/out
    Fiddle::TYPE_VOIDP,  # forecol : DWORD* in/out
  ],
  Fiddle::TYPE_INT)
#[link(name = "gdiplus")]
extern "system" {
    fn GdipGetHatchForegroundColor(
        brush: *mut GpHatch,  // GpHatch* in/out
        forecol: *mut u32  // DWORD* in/out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("gdiplus.dll")]
public static extern int GdipGetHatchForegroundColor(IntPtr brush, ref uint forecol);
"@
$api = Add-Type -MemberDefinition $sig -Name 'gdiplus_GdipGetHatchForegroundColor' -Namespace Win32 -PassThru
# $api::GdipGetHatchForegroundColor(brush, forecol)
#uselib "gdiplus.dll"
#func global GdipGetHatchForegroundColor "GdipGetHatchForegroundColor" sptr, sptr
; GdipGetHatchForegroundColor varptr(brush), varptr(forecol)   ; 戻り値は stat
; brush : GpHatch* in/out -> "sptr"
; forecol : DWORD* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "gdiplus.dll"
#cfunc global GdipGetHatchForegroundColor "GdipGetHatchForegroundColor" var, var
; res = GdipGetHatchForegroundColor(brush, forecol)
; brush : GpHatch* in/out -> "var"
; forecol : DWORD* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; Status GdipGetHatchForegroundColor(GpHatch* brush, DWORD* forecol)
#uselib "gdiplus.dll"
#cfunc global GdipGetHatchForegroundColor "GdipGetHatchForegroundColor" var, var
; res = GdipGetHatchForegroundColor(brush, forecol)
; brush : GpHatch* in/out -> "var"
; forecol : DWORD* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
	procGdipGetHatchForegroundColor = gdiplus.NewProc("GdipGetHatchForegroundColor")
)

// brush (GpHatch* in/out), forecol (DWORD* in/out)
r1, _, err := procGdipGetHatchForegroundColor.Call(
	uintptr(brush),
	uintptr(forecol),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // Status
function GdipGetHatchForegroundColor(
  brush: Pointer;   // GpHatch* in/out
  forecol: Pointer   // DWORD* in/out
): Integer; stdcall;
  external 'gdiplus.dll' name 'GdipGetHatchForegroundColor';
result := DllCall("gdiplus\GdipGetHatchForegroundColor"
    , "Ptr", brush   ; GpHatch* in/out
    , "Ptr", forecol   ; DWORD* in/out
    , "Int")   ; return: Status
●GdipGetHatchForegroundColor(brush, forecol) = DLL("gdiplus.dll", "int GdipGetHatchForegroundColor(void*, void*)")
# 呼び出し: GdipGetHatchForegroundColor(brush, forecol)
# brush : GpHatch* in/out -> "void*"
# forecol : DWORD* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。