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