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