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