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