ホーム › UI.Magnification › MagSetWindowSource
MagSetWindowSource
関数拡大鏡ウィンドウが拡大表示する元の領域を設定する。
シグネチャ
// MAGNIFICATION.dll
#include <windows.h>
BOOL MagSetWindowSource(
HWND hwnd,
RECT rect
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hwnd | HWND | in | 拡大鏡コントロールのウィンドウハンドルを指定する。 |
| rect | RECT | in | 拡大表示する元の画面領域を画面座標のRECTで指定する。 |
戻り値の型: BOOL
各言語での呼び出し定義
// MAGNIFICATION.dll
#include <windows.h>
BOOL MagSetWindowSource(
HWND hwnd,
RECT rect
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("MAGNIFICATION.dll", ExactSpelling = true)]
static extern bool MagSetWindowSource(
IntPtr hwnd, // HWND
RECT rect // RECT
);<DllImport("MAGNIFICATION.dll", ExactSpelling:=True)>
Public Shared Function MagSetWindowSource(
hwnd As IntPtr, ' HWND
rect As RECT ' RECT
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function' hwnd : HWND
' rect : RECT
Declare PtrSafe Function MagSetWindowSource Lib "magnification" ( _
ByVal hwnd As LongPtr, _
ByVal rect As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
MagSetWindowSource = ctypes.windll.magnification.MagSetWindowSource
MagSetWindowSource.restype = wintypes.BOOL
MagSetWindowSource.argtypes = [
wintypes.HANDLE, # hwnd : HWND
RECT, # rect : RECT
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MAGNIFICATION.dll')
MagSetWindowSource = Fiddle::Function.new(
lib['MagSetWindowSource'],
[
Fiddle::TYPE_VOIDP, # hwnd : HWND
Fiddle::TYPE_VOIDP, # rect : RECT
],
Fiddle::TYPE_INT)#[link(name = "magnification")]
extern "system" {
fn MagSetWindowSource(
hwnd: *mut core::ffi::c_void, // HWND
rect: RECT // RECT
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("MAGNIFICATION.dll")]
public static extern bool MagSetWindowSource(IntPtr hwnd, RECT rect);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MAGNIFICATION_MagSetWindowSource' -Namespace Win32 -PassThru
# $api::MagSetWindowSource(hwnd, rect)#uselib "MAGNIFICATION.dll"
#func global MagSetWindowSource "MagSetWindowSource" sptr, sptr
; MagSetWindowSource hwnd, rect ; 戻り値は stat
; hwnd : HWND -> "sptr"
; rect : RECT -> "sptr"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "MAGNIFICATION.dll"
#cfunc global MagSetWindowSource "MagSetWindowSource" sptr, int
; res = MagSetWindowSource(hwnd, rect)
; hwnd : HWND -> "sptr"
; rect : RECT -> "int"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。; BOOL MagSetWindowSource(HWND hwnd, RECT rect)
#uselib "MAGNIFICATION.dll"
#cfunc global MagSetWindowSource "MagSetWindowSource" intptr, int
; res = MagSetWindowSource(hwnd, rect)
; hwnd : HWND -> "intptr"
; rect : RECT -> "int"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
magnification = windows.NewLazySystemDLL("MAGNIFICATION.dll")
procMagSetWindowSource = magnification.NewProc("MagSetWindowSource")
)
// hwnd (HWND), rect (RECT)
r1, _, err := procMagSetWindowSource.Call(
uintptr(hwnd),
uintptr(rect),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction MagSetWindowSource(
hwnd: THandle; // HWND
rect: RECT // RECT
): BOOL; stdcall;
external 'MAGNIFICATION.dll' name 'MagSetWindowSource';result := DllCall("MAGNIFICATION\MagSetWindowSource"
, "Ptr", hwnd ; HWND
, "Ptr", rect ; RECT
, "Int") ; return: BOOL●MagSetWindowSource(hwnd, rect) = DLL("MAGNIFICATION.dll", "bool MagSetWindowSource(void*, void*)")
# 呼び出し: MagSetWindowSource(hwnd, rect)
# hwnd : HWND -> "void*"
# rect : RECT -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "magnification" fn MagSetWindowSource(
hwnd: ?*anyopaque, // HWND
rect: RECT // RECT
) callconv(std.os.windows.WINAPI) i32;proc MagSetWindowSource(
hwnd: pointer, # HWND
rect: RECT # RECT
): int32 {.importc: "MagSetWindowSource", stdcall, dynlib: "MAGNIFICATION.dll".}pragma(lib, "magnification");
extern(Windows)
int MagSetWindowSource(
void* hwnd, // HWND
RECT rect // RECT
);ccall((:MagSetWindowSource, "MAGNIFICATION.dll"), stdcall, Int32,
(Ptr{Cvoid}, RECT),
hwnd, rect)
# hwnd : HWND -> Ptr{Cvoid}
# rect : RECT -> RECT
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t MagSetWindowSource(
void* hwnd,
RECT rect);
]]
local magnification = ffi.load("magnification")
-- magnification.MagSetWindowSource(hwnd, rect)
-- hwnd : HWND
-- rect : RECT
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('MAGNIFICATION.dll');
const MagSetWindowSource = lib.func('__stdcall', 'MagSetWindowSource', 'int32_t', ['void *', 'RECT']);
// MagSetWindowSource(hwnd, rect)
// hwnd : HWND -> 'void *'
// rect : RECT -> 'RECT'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("MAGNIFICATION.dll", {
MagSetWindowSource: { parameters: ["pointer", "buffer"], result: "i32" },
});
// lib.symbols.MagSetWindowSource(hwnd, rect)
// hwnd : HWND -> "pointer"
// rect : RECT -> "buffer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t MagSetWindowSource(
void* hwnd,
RECT rect);
C, "MAGNIFICATION.dll");
// $ffi->MagSetWindowSource(hwnd, rect);
// hwnd : HWND
// rect : 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 MagSetWindowSource(
Pointer hwnd, // HWND
RECT /* extends Structure (by value) */ rect // RECT
);
}@[Link("magnification")]
lib LibMAGNIFICATION
fun MagSetWindowSource = MagSetWindowSource(
hwnd : Void*, # HWND
rect : 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 MagSetWindowSourceNative = Int32 Function(Pointer<Void>, RECT);
typedef MagSetWindowSourceDart = int Function(Pointer<Void>, int);
final MagSetWindowSource = DynamicLibrary.open('MAGNIFICATION.dll')
.lookupFunction<MagSetWindowSourceNative, MagSetWindowSourceDart>('MagSetWindowSource');
// hwnd : HWND -> Pointer<Void>
// rect : RECT -> RECT
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function MagSetWindowSource(
hwnd: THandle; // HWND
rect: RECT // RECT
): BOOL; stdcall;
external 'MAGNIFICATION.dll' name 'MagSetWindowSource';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "MagSetWindowSource"
c_MagSetWindowSource :: Ptr () -> RECT -> IO CInt
-- hwnd : HWND -> Ptr ()
-- rect : RECT -> RECT
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
-- ※値渡し構造体は GHC FFI で直接渡せません。Ptr で渡すラッパ(C側)経由にしてください。open Ctypes
open Foreign
let magsetwindowsource =
foreign "MagSetWindowSource"
((ptr void) @-> RECT @-> returning int32_t)
(* hwnd : HWND -> (ptr void) *)
(* rect : RECT -> RECT *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library magnification (t "MAGNIFICATION.dll"))
(cffi:use-foreign-library magnification)
(cffi:defcfun ("MagSetWindowSource" mag-set-window-source :convention :stdcall) :int32
(hwnd :pointer) ; HWND
(rect (:struct rect))) ; RECT
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $MagSetWindowSource = Win32::API::More->new('MAGNIFICATION',
'BOOL MagSetWindowSource(HANDLE hwnd, LPVOID rect)');
# my $ret = $MagSetWindowSource->Call($hwnd, $rect);
# hwnd : HWND -> HANDLE
# rect : RECT -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型