ホーム › UI.Magnification › MagGetWindowTransform
MagGetWindowTransform
関数拡大鏡ウィンドウの拡大率変換行列を取得する。
シグネチャ
// MAGNIFICATION.dll
#include <windows.h>
BOOL MagGetWindowTransform(
HWND hwnd,
MAGTRANSFORM* pTransform
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hwnd | HWND | in | 拡大鏡コントロールのウィンドウハンドルを指定する。 |
| pTransform | MAGTRANSFORM* | inout | 現在の拡大変換行列を受け取るMAGTRANSFORMへのポインタ。 |
戻り値の型: BOOL
各言語での呼び出し定義
// MAGNIFICATION.dll
#include <windows.h>
BOOL MagGetWindowTransform(
HWND hwnd,
MAGTRANSFORM* pTransform
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("MAGNIFICATION.dll", ExactSpelling = true)]
static extern bool MagGetWindowTransform(
IntPtr hwnd, // HWND
IntPtr pTransform // MAGTRANSFORM* in/out
);<DllImport("MAGNIFICATION.dll", ExactSpelling:=True)>
Public Shared Function MagGetWindowTransform(
hwnd As IntPtr, ' HWND
pTransform As IntPtr ' MAGTRANSFORM* in/out
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function' hwnd : HWND
' pTransform : MAGTRANSFORM* in/out
Declare PtrSafe Function MagGetWindowTransform Lib "magnification" ( _
ByVal hwnd As LongPtr, _
ByVal pTransform As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
MagGetWindowTransform = ctypes.windll.magnification.MagGetWindowTransform
MagGetWindowTransform.restype = wintypes.BOOL
MagGetWindowTransform.argtypes = [
wintypes.HANDLE, # hwnd : HWND
ctypes.c_void_p, # pTransform : MAGTRANSFORM* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MAGNIFICATION.dll')
MagGetWindowTransform = Fiddle::Function.new(
lib['MagGetWindowTransform'],
[
Fiddle::TYPE_VOIDP, # hwnd : HWND
Fiddle::TYPE_VOIDP, # pTransform : MAGTRANSFORM* in/out
],
Fiddle::TYPE_INT)#[link(name = "magnification")]
extern "system" {
fn MagGetWindowTransform(
hwnd: *mut core::ffi::c_void, // HWND
pTransform: *mut MAGTRANSFORM // MAGTRANSFORM* 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 MagGetWindowTransform(IntPtr hwnd, IntPtr pTransform);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MAGNIFICATION_MagGetWindowTransform' -Namespace Win32 -PassThru
# $api::MagGetWindowTransform(hwnd, pTransform)#uselib "MAGNIFICATION.dll"
#func global MagGetWindowTransform "MagGetWindowTransform" sptr, sptr
; MagGetWindowTransform hwnd, varptr(pTransform) ; 戻り値は stat
; hwnd : HWND -> "sptr"
; pTransform : MAGTRANSFORM* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "MAGNIFICATION.dll" #cfunc global MagGetWindowTransform "MagGetWindowTransform" sptr, var ; res = MagGetWindowTransform(hwnd, pTransform) ; hwnd : HWND -> "sptr" ; pTransform : MAGTRANSFORM* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "MAGNIFICATION.dll" #cfunc global MagGetWindowTransform "MagGetWindowTransform" sptr, sptr ; res = MagGetWindowTransform(hwnd, varptr(pTransform)) ; hwnd : HWND -> "sptr" ; pTransform : MAGTRANSFORM* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL MagGetWindowTransform(HWND hwnd, MAGTRANSFORM* pTransform) #uselib "MAGNIFICATION.dll" #cfunc global MagGetWindowTransform "MagGetWindowTransform" intptr, var ; res = MagGetWindowTransform(hwnd, pTransform) ; hwnd : HWND -> "intptr" ; pTransform : MAGTRANSFORM* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL MagGetWindowTransform(HWND hwnd, MAGTRANSFORM* pTransform) #uselib "MAGNIFICATION.dll" #cfunc global MagGetWindowTransform "MagGetWindowTransform" intptr, intptr ; res = MagGetWindowTransform(hwnd, varptr(pTransform)) ; hwnd : HWND -> "intptr" ; pTransform : MAGTRANSFORM* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
magnification = windows.NewLazySystemDLL("MAGNIFICATION.dll")
procMagGetWindowTransform = magnification.NewProc("MagGetWindowTransform")
)
// hwnd (HWND), pTransform (MAGTRANSFORM* in/out)
r1, _, err := procMagGetWindowTransform.Call(
uintptr(hwnd),
uintptr(pTransform),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction MagGetWindowTransform(
hwnd: THandle; // HWND
pTransform: Pointer // MAGTRANSFORM* in/out
): BOOL; stdcall;
external 'MAGNIFICATION.dll' name 'MagGetWindowTransform';result := DllCall("MAGNIFICATION\MagGetWindowTransform"
, "Ptr", hwnd ; HWND
, "Ptr", pTransform ; MAGTRANSFORM* in/out
, "Int") ; return: BOOL●MagGetWindowTransform(hwnd, pTransform) = DLL("MAGNIFICATION.dll", "bool MagGetWindowTransform(void*, void*)")
# 呼び出し: MagGetWindowTransform(hwnd, pTransform)
# hwnd : HWND -> "void*"
# pTransform : MAGTRANSFORM* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "magnification" fn MagGetWindowTransform(
hwnd: ?*anyopaque, // HWND
pTransform: [*c]MAGTRANSFORM // MAGTRANSFORM* in/out
) callconv(std.os.windows.WINAPI) i32;proc MagGetWindowTransform(
hwnd: pointer, # HWND
pTransform: ptr MAGTRANSFORM # MAGTRANSFORM* in/out
): int32 {.importc: "MagGetWindowTransform", stdcall, dynlib: "MAGNIFICATION.dll".}pragma(lib, "magnification");
extern(Windows)
int MagGetWindowTransform(
void* hwnd, // HWND
MAGTRANSFORM* pTransform // MAGTRANSFORM* in/out
);ccall((:MagGetWindowTransform, "MAGNIFICATION.dll"), stdcall, Int32,
(Ptr{Cvoid}, Ptr{MAGTRANSFORM}),
hwnd, pTransform)
# hwnd : HWND -> Ptr{Cvoid}
# pTransform : MAGTRANSFORM* in/out -> Ptr{MAGTRANSFORM}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t MagGetWindowTransform(
void* hwnd,
void* pTransform);
]]
local magnification = ffi.load("magnification")
-- magnification.MagGetWindowTransform(hwnd, pTransform)
-- hwnd : HWND
-- pTransform : MAGTRANSFORM* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('MAGNIFICATION.dll');
const MagGetWindowTransform = lib.func('__stdcall', 'MagGetWindowTransform', 'int32_t', ['void *', 'void *']);
// MagGetWindowTransform(hwnd, pTransform)
// hwnd : HWND -> 'void *'
// pTransform : MAGTRANSFORM* in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("MAGNIFICATION.dll", {
MagGetWindowTransform: { parameters: ["pointer", "pointer"], result: "i32" },
});
// lib.symbols.MagGetWindowTransform(hwnd, pTransform)
// hwnd : HWND -> "pointer"
// pTransform : MAGTRANSFORM* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t MagGetWindowTransform(
void* hwnd,
void* pTransform);
C, "MAGNIFICATION.dll");
// $ffi->MagGetWindowTransform(hwnd, pTransform);
// hwnd : HWND
// pTransform : MAGTRANSFORM* in/out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Magnification extends StdCallLibrary {
Magnification INSTANCE = Native.load("magnification", Magnification.class);
boolean MagGetWindowTransform(
Pointer hwnd, // HWND
Pointer pTransform // MAGTRANSFORM* in/out
);
}@[Link("magnification")]
lib LibMAGNIFICATION
fun MagGetWindowTransform = MagGetWindowTransform(
hwnd : Void*, # HWND
pTransform : MAGTRANSFORM* # MAGTRANSFORM* in/out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef MagGetWindowTransformNative = Int32 Function(Pointer<Void>, Pointer<Void>);
typedef MagGetWindowTransformDart = int Function(Pointer<Void>, Pointer<Void>);
final MagGetWindowTransform = DynamicLibrary.open('MAGNIFICATION.dll')
.lookupFunction<MagGetWindowTransformNative, MagGetWindowTransformDart>('MagGetWindowTransform');
// hwnd : HWND -> Pointer<Void>
// pTransform : MAGTRANSFORM* in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function MagGetWindowTransform(
hwnd: THandle; // HWND
pTransform: Pointer // MAGTRANSFORM* in/out
): BOOL; stdcall;
external 'MAGNIFICATION.dll' name 'MagGetWindowTransform';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "MagGetWindowTransform"
c_MagGetWindowTransform :: Ptr () -> Ptr () -> IO CInt
-- hwnd : HWND -> Ptr ()
-- pTransform : MAGTRANSFORM* in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let maggetwindowtransform =
foreign "MagGetWindowTransform"
((ptr void) @-> (ptr void) @-> returning int32_t)
(* hwnd : HWND -> (ptr void) *)
(* pTransform : MAGTRANSFORM* in/out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library magnification (t "MAGNIFICATION.dll"))
(cffi:use-foreign-library magnification)
(cffi:defcfun ("MagGetWindowTransform" mag-get-window-transform :convention :stdcall) :int32
(hwnd :pointer) ; HWND
(p-transform :pointer)) ; MAGTRANSFORM* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $MagGetWindowTransform = Win32::API::More->new('MAGNIFICATION',
'BOOL MagGetWindowTransform(HANDLE hwnd, LPVOID pTransform)');
# my $ret = $MagGetWindowTransform->Call($hwnd, $pTransform);
# hwnd : HWND -> HANDLE
# pTransform : MAGTRANSFORM* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型