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

MagSetInputTransform

関数
拡大表示に対応する入力座標変換を設定する。
DLLMAGNIFICATION.dll呼出規約winapiSetLastErrorあり対応OSwindows8.0

シグネチャ

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

BOOL MagSetInputTransform(
    BOOL fEnabled,
    const RECT* pRectSource,
    const RECT* pRectDest
);

パラメーター

名前方向説明
fEnabledBOOLinTRUEで入力座標変換を有効化、FALSEで無効化する。
pRectSourceRECT*in変換元となる画面上のソース矩形を表すRECTへのポインタ。
pRectDestRECT*in変換先の宛先矩形を表すRECTへのポインタ。

戻り値の型: BOOL

各言語での呼び出し定義

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

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

MagSetInputTransform = ctypes.windll.magnification.MagSetInputTransform
MagSetInputTransform.restype = wintypes.BOOL
MagSetInputTransform.argtypes = [
    wintypes.BOOL,  # fEnabled : BOOL
    ctypes.c_void_p,  # pRectSource : RECT*
    ctypes.c_void_p,  # pRectDest : RECT*
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

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

var (
	magnification = windows.NewLazySystemDLL("MAGNIFICATION.dll")
	procMagSetInputTransform = magnification.NewProc("MagSetInputTransform")
)

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

extern "magnification" fn MagSetInputTransform(
    fEnabled: i32, // BOOL
    pRectSource: [*c]RECT, // RECT*
    pRectDest: [*c]RECT // RECT*
) callconv(std.os.windows.WINAPI) i32;
proc MagSetInputTransform(
    fEnabled: int32,  # BOOL
    pRectSource: ptr RECT,  # RECT*
    pRectDest: ptr RECT  # RECT*
): int32 {.importc: "MagSetInputTransform", stdcall, dynlib: "MAGNIFICATION.dll".}
pragma(lib, "magnification");
extern(Windows)
int MagSetInputTransform(
    int fEnabled,   // BOOL
    RECT* pRectSource,   // RECT*
    RECT* pRectDest   // RECT*
);
ccall((:MagSetInputTransform, "MAGNIFICATION.dll"), stdcall, Int32,
      (Int32, Ptr{RECT}, Ptr{RECT}),
      fEnabled, pRectSource, pRectDest)
# fEnabled : BOOL -> Int32
# pRectSource : RECT* -> Ptr{RECT}
# pRectDest : RECT* -> Ptr{RECT}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t MagSetInputTransform(
    int32_t fEnabled,
    void* pRectSource,
    void* pRectDest);
]]
local magnification = ffi.load("magnification")
-- magnification.MagSetInputTransform(fEnabled, pRectSource, pRectDest)
-- fEnabled : BOOL
-- pRectSource : RECT*
-- pRectDest : RECT*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('MAGNIFICATION.dll');
const MagSetInputTransform = lib.func('__stdcall', 'MagSetInputTransform', 'int32_t', ['int32_t', 'void *', 'void *']);
// MagSetInputTransform(fEnabled, pRectSource, pRectDest)
// fEnabled : BOOL -> 'int32_t'
// pRectSource : RECT* -> 'void *'
// pRectDest : RECT* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("MAGNIFICATION.dll", {
  MagSetInputTransform: { parameters: ["i32", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.MagSetInputTransform(fEnabled, pRectSource, pRectDest)
// fEnabled : BOOL -> "i32"
// pRectSource : RECT* -> "pointer"
// pRectDest : RECT* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t MagSetInputTransform(
    int32_t fEnabled,
    void* pRectSource,
    void* pRectDest);
C, "MAGNIFICATION.dll");
// $ffi->MagSetInputTransform(fEnabled, pRectSource, pRectDest);
// fEnabled : BOOL
// pRectSource : RECT*
// pRectDest : RECT*
// 構造体/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 MagSetInputTransform(
        boolean fEnabled,   // BOOL
        Pointer pRectSource,   // RECT*
        Pointer pRectDest   // RECT*
    );
}
@[Link("magnification")]
lib LibMAGNIFICATION
  fun MagSetInputTransform = MagSetInputTransform(
    fEnabled : Int32,   # BOOL
    pRectSource : RECT*,   # RECT*
    pRectDest : RECT*   # RECT*
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef MagSetInputTransformNative = Int32 Function(Int32, Pointer<Void>, Pointer<Void>);
typedef MagSetInputTransformDart = int Function(int, Pointer<Void>, Pointer<Void>);
final MagSetInputTransform = DynamicLibrary.open('MAGNIFICATION.dll')
    .lookupFunction<MagSetInputTransformNative, MagSetInputTransformDart>('MagSetInputTransform');
// fEnabled : BOOL -> Int32
// pRectSource : RECT* -> Pointer<Void>
// pRectDest : RECT* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function MagSetInputTransform(
  fEnabled: BOOL;   // BOOL
  pRectSource: Pointer;   // RECT*
  pRectDest: Pointer   // RECT*
): BOOL; stdcall;
  external 'MAGNIFICATION.dll' name 'MagSetInputTransform';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "MagSetInputTransform"
  c_MagSetInputTransform :: CInt -> Ptr () -> Ptr () -> IO CInt
-- fEnabled : BOOL -> CInt
-- pRectSource : RECT* -> Ptr ()
-- pRectDest : RECT* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let magsetinputtransform =
  foreign "MagSetInputTransform"
    (int32_t @-> (ptr void) @-> (ptr void) @-> returning int32_t)
(* fEnabled : BOOL -> int32_t *)
(* pRectSource : RECT* -> (ptr void) *)
(* pRectDest : RECT* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library magnification (t "MAGNIFICATION.dll"))
(cffi:use-foreign-library magnification)

(cffi:defcfun ("MagSetInputTransform" mag-set-input-transform :convention :stdcall) :int32
  (f-enabled :int32)   ; BOOL
  (p-rect-source :pointer)   ; RECT*
  (p-rect-dest :pointer))   ; RECT*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $MagSetInputTransform = Win32::API::More->new('MAGNIFICATION',
    'BOOL MagSetInputTransform(BOOL fEnabled, LPVOID pRectSource, LPVOID pRectDest)');
# my $ret = $MagSetInputTransform->Call($fEnabled, $pRectSource, $pRectDest);
# fEnabled : BOOL -> BOOL
# pRectSource : RECT* -> LPVOID
# pRectDest : RECT* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型