Win32 API 日本語リファレンス
ホームUI.Magnification › MagGetWindowSource

MagGetWindowSource

関数
拡大鏡ウィンドウの拡大元領域を取得する。
DLLMAGNIFICATION.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

// MAGNIFICATION.dll
#include <windows.h>

BOOL MagGetWindowSource(
    HWND hwnd,
    RECT* pRect
);

パラメーター

名前方向
hwndHWNDin
pRectRECT*inout

戻り値の型: BOOL

各言語での呼び出し定義

// MAGNIFICATION.dll
#include <windows.h>

BOOL MagGetWindowSource(
    HWND hwnd,
    RECT* pRect
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("MAGNIFICATION.dll", ExactSpelling = true)]
static extern bool MagGetWindowSource(
    IntPtr hwnd,   // HWND
    IntPtr pRect   // RECT* in/out
);
<DllImport("MAGNIFICATION.dll", ExactSpelling:=True)>
Public Shared Function MagGetWindowSource(
    hwnd As IntPtr,   ' HWND
    pRect As IntPtr   ' RECT* in/out
) As Boolean
End Function
' hwnd : HWND
' pRect : RECT* in/out
Declare PtrSafe Function MagGetWindowSource Lib "magnification" ( _
    ByVal hwnd As LongPtr, _
    ByVal pRect As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MagGetWindowSource = ctypes.windll.magnification.MagGetWindowSource
MagGetWindowSource.restype = wintypes.BOOL
MagGetWindowSource.argtypes = [
    wintypes.HANDLE,  # hwnd : HWND
    ctypes.c_void_p,  # pRect : RECT* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MAGNIFICATION.dll')
MagGetWindowSource = Fiddle::Function.new(
  lib['MagGetWindowSource'],
  [
    Fiddle::TYPE_VOIDP,  # hwnd : HWND
    Fiddle::TYPE_VOIDP,  # pRect : RECT* in/out
  ],
  Fiddle::TYPE_INT)
#[link(name = "magnification")]
extern "system" {
    fn MagGetWindowSource(
        hwnd: *mut core::ffi::c_void,  // HWND
        pRect: *mut RECT  // RECT* in/out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("MAGNIFICATION.dll")]
public static extern bool MagGetWindowSource(IntPtr hwnd, IntPtr pRect);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MAGNIFICATION_MagGetWindowSource' -Namespace Win32 -PassThru
# $api::MagGetWindowSource(hwnd, pRect)
#uselib "MAGNIFICATION.dll"
#func global MagGetWindowSource "MagGetWindowSource" sptr, sptr
; MagGetWindowSource hwnd, varptr(pRect)   ; 戻り値は stat
; hwnd : HWND -> "sptr"
; pRect : RECT* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "MAGNIFICATION.dll"
#cfunc global MagGetWindowSource "MagGetWindowSource" sptr, var
; res = MagGetWindowSource(hwnd, pRect)
; hwnd : HWND -> "sptr"
; pRect : RECT* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; BOOL MagGetWindowSource(HWND hwnd, RECT* pRect)
#uselib "MAGNIFICATION.dll"
#cfunc global MagGetWindowSource "MagGetWindowSource" intptr, var
; res = MagGetWindowSource(hwnd, pRect)
; hwnd : HWND -> "intptr"
; pRect : RECT* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	magnification = windows.NewLazySystemDLL("MAGNIFICATION.dll")
	procMagGetWindowSource = magnification.NewProc("MagGetWindowSource")
)

// hwnd (HWND), pRect (RECT* in/out)
r1, _, err := procMagGetWindowSource.Call(
	uintptr(hwnd),
	uintptr(pRect),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function MagGetWindowSource(
  hwnd: THandle;   // HWND
  pRect: Pointer   // RECT* in/out
): BOOL; stdcall;
  external 'MAGNIFICATION.dll' name 'MagGetWindowSource';
result := DllCall("MAGNIFICATION\MagGetWindowSource"
    , "Ptr", hwnd   ; HWND
    , "Ptr", pRect   ; RECT* in/out
    , "Int")   ; return: BOOL
●MagGetWindowSource(hwnd, pRect) = DLL("MAGNIFICATION.dll", "bool MagGetWindowSource(void*, void*)")
# 呼び出し: MagGetWindowSource(hwnd, pRect)
# hwnd : HWND -> "void*"
# pRect : RECT* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。