Win32 API 日本語リファレンス
ホームSystem.WindowsProgramming › DCICreateOverlay

DCICreateOverlay

関数
オーバーレイサーフェスを作成する。
DLLDCIMAN32.dll呼出規約winapi

シグネチャ

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

INT DCICreateOverlay(
    HDC hdc,
    void* lpOffscreenSurf,
    DCIOVERLAY** lplpSurface
);

パラメーター

名前方向
hdcHDCin
lpOffscreenSurfvoid*inout
lplpSurfaceDCIOVERLAY**inout

戻り値の型: 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 方式にも切替可。
出力引数:
; 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 方式にも切替可。
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   // INT
function 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)。