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