Win32 API 日本語リファレンス
ホームGraphics.Dwm › DwmShowContact

DwmShowContact

関数
指定したタッチ接触点の視覚フィードバックを表示する。
DLLdwmapi.dll呼出規約winapi対応OSwindows8.0

シグネチャ

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

HRESULT DwmShowContact(
    DWORD dwPointerID,
    DWM_SHOWCONTACT eShowContact
);

パラメーター

名前方向説明
dwPointerIDDWORDin表示制御対象とする接触点のポインターID。
eShowContactDWM_SHOWCONTACTin接触点の可視化方法を示すDWM_SHOWCONTACTフラグ。

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT DwmShowContact(
    DWORD dwPointerID,
    DWM_SHOWCONTACT eShowContact
);
[DllImport("dwmapi.dll", ExactSpelling = true)]
static extern int DwmShowContact(
    uint dwPointerID,   // DWORD
    uint eShowContact   // DWM_SHOWCONTACT
);
<DllImport("dwmapi.dll", ExactSpelling:=True)>
Public Shared Function DwmShowContact(
    dwPointerID As UInteger,   ' DWORD
    eShowContact As UInteger   ' DWM_SHOWCONTACT
) As Integer
End Function
' dwPointerID : DWORD
' eShowContact : DWM_SHOWCONTACT
Declare PtrSafe Function DwmShowContact Lib "dwmapi" ( _
    ByVal dwPointerID As Long, _
    ByVal eShowContact As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

DwmShowContact = ctypes.windll.dwmapi.DwmShowContact
DwmShowContact.restype = ctypes.c_int
DwmShowContact.argtypes = [
    wintypes.DWORD,  # dwPointerID : DWORD
    wintypes.DWORD,  # eShowContact : DWM_SHOWCONTACT
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('dwmapi.dll')
DwmShowContact = Fiddle::Function.new(
  lib['DwmShowContact'],
  [
    -Fiddle::TYPE_INT,  # dwPointerID : DWORD
    -Fiddle::TYPE_INT,  # eShowContact : DWM_SHOWCONTACT
  ],
  Fiddle::TYPE_INT)
#[link(name = "dwmapi")]
extern "system" {
    fn DwmShowContact(
        dwPointerID: u32,  // DWORD
        eShowContact: u32  // DWM_SHOWCONTACT
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("dwmapi.dll")]
public static extern int DwmShowContact(uint dwPointerID, uint eShowContact);
"@
$api = Add-Type -MemberDefinition $sig -Name 'dwmapi_DwmShowContact' -Namespace Win32 -PassThru
# $api::DwmShowContact(dwPointerID, eShowContact)
#uselib "dwmapi.dll"
#func global DwmShowContact "DwmShowContact" sptr, sptr
; DwmShowContact dwPointerID, eShowContact   ; 戻り値は stat
; dwPointerID : DWORD -> "sptr"
; eShowContact : DWM_SHOWCONTACT -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "dwmapi.dll"
#cfunc global DwmShowContact "DwmShowContact" int, int
; res = DwmShowContact(dwPointerID, eShowContact)
; dwPointerID : DWORD -> "int"
; eShowContact : DWM_SHOWCONTACT -> "int"
; HRESULT DwmShowContact(DWORD dwPointerID, DWM_SHOWCONTACT eShowContact)
#uselib "dwmapi.dll"
#cfunc global DwmShowContact "DwmShowContact" int, int
; res = DwmShowContact(dwPointerID, eShowContact)
; dwPointerID : DWORD -> "int"
; eShowContact : DWM_SHOWCONTACT -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	dwmapi = windows.NewLazySystemDLL("dwmapi.dll")
	procDwmShowContact = dwmapi.NewProc("DwmShowContact")
)

// dwPointerID (DWORD), eShowContact (DWM_SHOWCONTACT)
r1, _, err := procDwmShowContact.Call(
	uintptr(dwPointerID),
	uintptr(eShowContact),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function DwmShowContact(
  dwPointerID: DWORD;   // DWORD
  eShowContact: DWORD   // DWM_SHOWCONTACT
): Integer; stdcall;
  external 'dwmapi.dll' name 'DwmShowContact';
result := DllCall("dwmapi\DwmShowContact"
    , "UInt", dwPointerID   ; DWORD
    , "UInt", eShowContact   ; DWM_SHOWCONTACT
    , "Int")   ; return: HRESULT
●DwmShowContact(dwPointerID, eShowContact) = DLL("dwmapi.dll", "int DwmShowContact(dword, dword)")
# 呼び出し: DwmShowContact(dwPointerID, eShowContact)
# dwPointerID : DWORD -> "dword"
# eShowContact : DWM_SHOWCONTACT -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

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

typedef DwmShowContactNative = Int32 Function(Uint32, Uint32);
typedef DwmShowContactDart = int Function(int, int);
final DwmShowContact = DynamicLibrary.open('dwmapi.dll')
    .lookupFunction<DwmShowContactNative, DwmShowContactDart>('DwmShowContact');
// dwPointerID : DWORD -> Uint32
// eShowContact : DWM_SHOWCONTACT -> Uint32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function DwmShowContact(
  dwPointerID: DWORD;   // DWORD
  eShowContact: DWORD   // DWM_SHOWCONTACT
): Integer; stdcall;
  external 'dwmapi.dll' name 'DwmShowContact';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "DwmShowContact"
  c_DwmShowContact :: Word32 -> Word32 -> IO Int32
-- dwPointerID : DWORD -> Word32
-- eShowContact : DWM_SHOWCONTACT -> Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let dwmshowcontact =
  foreign "DwmShowContact"
    (uint32_t @-> uint32_t @-> returning int32_t)
(* dwPointerID : DWORD -> uint32_t *)
(* eShowContact : DWM_SHOWCONTACT -> uint32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library dwmapi (t "dwmapi.dll"))
(cffi:use-foreign-library dwmapi)

(cffi:defcfun ("DwmShowContact" dwm-show-contact :convention :stdcall) :int32
  (dw-pointer-id :uint32)   ; DWORD
  (e-show-contact :uint32))   ; DWM_SHOWCONTACT
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $DwmShowContact = Win32::API::More->new('dwmapi',
    'int DwmShowContact(DWORD dwPointerID, DWORD eShowContact)');
# my $ret = $DwmShowContact->Call($dwPointerID, $eShowContact);
# dwPointerID : DWORD -> DWORD
# eShowContact : DWM_SHOWCONTACT -> DWORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型