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