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