ホーム › Graphics.Dwm › DwmTetherContact
DwmTetherContact
関数タッチ接触点をテザリング(係留)する。
シグネチャ
// dwmapi.dll
#include <windows.h>
HRESULT DwmTetherContact(
DWORD dwPointerID,
BOOL fEnable,
POINT ptTether
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| dwPointerID | DWORD | in | テザー対象とする接触点のポインターID。 |
| fEnable | BOOL | in | テザー(係留)表示を有効にするか示す真偽値。 |
| ptTether | POINT | in | テザー先となる画面座標を示すPOINT。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// dwmapi.dll
#include <windows.h>
HRESULT DwmTetherContact(
DWORD dwPointerID,
BOOL fEnable,
POINT ptTether
);[DllImport("dwmapi.dll", ExactSpelling = true)]
static extern int DwmTetherContact(
uint dwPointerID, // DWORD
bool fEnable, // BOOL
POINT ptTether // POINT
);<DllImport("dwmapi.dll", ExactSpelling:=True)>
Public Shared Function DwmTetherContact(
dwPointerID As UInteger, ' DWORD
fEnable As Boolean, ' BOOL
ptTether As POINT ' POINT
) As Integer
End Function' dwPointerID : DWORD
' fEnable : BOOL
' ptTether : POINT
Declare PtrSafe Function DwmTetherContact Lib "dwmapi" ( _
ByVal dwPointerID As Long, _
ByVal fEnable As Long, _
ByVal ptTether As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DwmTetherContact = ctypes.windll.dwmapi.DwmTetherContact
DwmTetherContact.restype = ctypes.c_int
DwmTetherContact.argtypes = [
wintypes.DWORD, # dwPointerID : DWORD
wintypes.BOOL, # fEnable : BOOL
POINT, # ptTether : POINT
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('dwmapi.dll')
DwmTetherContact = Fiddle::Function.new(
lib['DwmTetherContact'],
[
-Fiddle::TYPE_INT, # dwPointerID : DWORD
Fiddle::TYPE_INT, # fEnable : BOOL
Fiddle::TYPE_VOIDP, # ptTether : POINT
],
Fiddle::TYPE_INT)#[link(name = "dwmapi")]
extern "system" {
fn DwmTetherContact(
dwPointerID: u32, // DWORD
fEnable: i32, // BOOL
ptTether: POINT // POINT
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("dwmapi.dll")]
public static extern int DwmTetherContact(uint dwPointerID, bool fEnable, POINT ptTether);
"@
$api = Add-Type -MemberDefinition $sig -Name 'dwmapi_DwmTetherContact' -Namespace Win32 -PassThru
# $api::DwmTetherContact(dwPointerID, fEnable, ptTether)#uselib "dwmapi.dll"
#func global DwmTetherContact "DwmTetherContact" sptr, sptr, sptr
; DwmTetherContact dwPointerID, fEnable, ptTether ; 戻り値は stat
; dwPointerID : DWORD -> "sptr"
; fEnable : BOOL -> "sptr"
; ptTether : POINT -> "sptr"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "dwmapi.dll"
#cfunc global DwmTetherContact "DwmTetherContact" int, int, int
; res = DwmTetherContact(dwPointerID, fEnable, ptTether)
; dwPointerID : DWORD -> "int"
; fEnable : BOOL -> "int"
; ptTether : POINT -> "int"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。; HRESULT DwmTetherContact(DWORD dwPointerID, BOOL fEnable, POINT ptTether)
#uselib "dwmapi.dll"
#cfunc global DwmTetherContact "DwmTetherContact" int, int, int
; res = DwmTetherContact(dwPointerID, fEnable, ptTether)
; dwPointerID : DWORD -> "int"
; fEnable : BOOL -> "int"
; ptTether : POINT -> "int"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
dwmapi = windows.NewLazySystemDLL("dwmapi.dll")
procDwmTetherContact = dwmapi.NewProc("DwmTetherContact")
)
// dwPointerID (DWORD), fEnable (BOOL), ptTether (POINT)
r1, _, err := procDwmTetherContact.Call(
uintptr(dwPointerID),
uintptr(fEnable),
uintptr(ptTether),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction DwmTetherContact(
dwPointerID: DWORD; // DWORD
fEnable: BOOL; // BOOL
ptTether: POINT // POINT
): Integer; stdcall;
external 'dwmapi.dll' name 'DwmTetherContact';result := DllCall("dwmapi\DwmTetherContact"
, "UInt", dwPointerID ; DWORD
, "Int", fEnable ; BOOL
, "Ptr", ptTether ; POINT
, "Int") ; return: HRESULT●DwmTetherContact(dwPointerID, fEnable, ptTether) = DLL("dwmapi.dll", "int DwmTetherContact(dword, bool, void*)")
# 呼び出し: DwmTetherContact(dwPointerID, fEnable, ptTether)
# dwPointerID : DWORD -> "dword"
# fEnable : BOOL -> "bool"
# ptTether : POINT -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "dwmapi" fn DwmTetherContact(
dwPointerID: u32, // DWORD
fEnable: i32, // BOOL
ptTether: POINT // POINT
) callconv(std.os.windows.WINAPI) i32;proc DwmTetherContact(
dwPointerID: uint32, # DWORD
fEnable: int32, # BOOL
ptTether: POINT # POINT
): int32 {.importc: "DwmTetherContact", stdcall, dynlib: "dwmapi.dll".}pragma(lib, "dwmapi");
extern(Windows)
int DwmTetherContact(
uint dwPointerID, // DWORD
int fEnable, // BOOL
POINT ptTether // POINT
);ccall((:DwmTetherContact, "dwmapi.dll"), stdcall, Int32,
(UInt32, Int32, POINT),
dwPointerID, fEnable, ptTether)
# dwPointerID : DWORD -> UInt32
# fEnable : BOOL -> Int32
# ptTether : POINT -> POINT
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t DwmTetherContact(
uint32_t dwPointerID,
int32_t fEnable,
POINT ptTether);
]]
local dwmapi = ffi.load("dwmapi")
-- dwmapi.DwmTetherContact(dwPointerID, fEnable, ptTether)
-- dwPointerID : DWORD
-- fEnable : BOOL
-- ptTether : POINT
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('dwmapi.dll');
const DwmTetherContact = lib.func('__stdcall', 'DwmTetherContact', 'int32_t', ['uint32_t', 'int32_t', 'POINT']);
// DwmTetherContact(dwPointerID, fEnable, ptTether)
// dwPointerID : DWORD -> 'uint32_t'
// fEnable : BOOL -> 'int32_t'
// ptTether : POINT -> 'POINT'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("dwmapi.dll", {
DwmTetherContact: { parameters: ["u32", "i32", "buffer"], result: "i32" },
});
// lib.symbols.DwmTetherContact(dwPointerID, fEnable, ptTether)
// dwPointerID : DWORD -> "u32"
// fEnable : BOOL -> "i32"
// ptTether : POINT -> "buffer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t DwmTetherContact(
uint32_t dwPointerID,
int32_t fEnable,
POINT ptTether);
C, "dwmapi.dll");
// $ffi->DwmTetherContact(dwPointerID, fEnable, ptTether);
// dwPointerID : DWORD
// fEnable : BOOL
// ptTether : POINT
// 構造体/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 DwmTetherContact(
int dwPointerID, // DWORD
boolean fEnable, // BOOL
POINT /* extends Structure (by value) */ ptTether // POINT
);
}@[Link("dwmapi")]
lib Libdwmapi
fun DwmTetherContact = DwmTetherContact(
dwPointerID : UInt32, # DWORD
fEnable : Int32, # BOOL
ptTether : POINT # POINT
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef DwmTetherContactNative = Int32 Function(Uint32, Int32, POINT);
typedef DwmTetherContactDart = int Function(int, int, int);
final DwmTetherContact = DynamicLibrary.open('dwmapi.dll')
.lookupFunction<DwmTetherContactNative, DwmTetherContactDart>('DwmTetherContact');
// dwPointerID : DWORD -> Uint32
// fEnable : BOOL -> Int32
// ptTether : POINT -> POINT
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function DwmTetherContact(
dwPointerID: DWORD; // DWORD
fEnable: BOOL; // BOOL
ptTether: POINT // POINT
): Integer; stdcall;
external 'dwmapi.dll' name 'DwmTetherContact';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "DwmTetherContact"
c_DwmTetherContact :: Word32 -> CInt -> POINT -> IO Int32
-- dwPointerID : DWORD -> Word32
-- fEnable : BOOL -> CInt
-- ptTether : POINT -> POINT
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
-- ※値渡し構造体は GHC FFI で直接渡せません。Ptr で渡すラッパ(C側)経由にしてください。open Ctypes
open Foreign
let dwmtethercontact =
foreign "DwmTetherContact"
(uint32_t @-> int32_t @-> POINT @-> returning int32_t)
(* dwPointerID : DWORD -> uint32_t *)
(* fEnable : BOOL -> int32_t *)
(* ptTether : POINT -> POINT *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library dwmapi (t "dwmapi.dll"))
(cffi:use-foreign-library dwmapi)
(cffi:defcfun ("DwmTetherContact" dwm-tether-contact :convention :stdcall) :int32
(dw-pointer-id :uint32) ; DWORD
(f-enable :int32) ; BOOL
(pt-tether (:struct point))) ; POINT
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $DwmTetherContact = Win32::API::More->new('dwmapi',
'int DwmTetherContact(DWORD dwPointerID, BOOL fEnable, LPVOID ptTether)');
# my $ret = $DwmTetherContact->Call($dwPointerID, $fEnable, $ptTether);
# dwPointerID : DWORD -> DWORD
# fEnable : BOOL -> BOOL
# ptTether : POINT -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型