ホーム › System.WindowsProgramming › DCICreateOffscreen
DCICreateOffscreen
関数オフスクリーン描画サーフェスを作成する。
シグネチャ
// DCIMAN32.dll
#include <windows.h>
INT DCICreateOffscreen(
HDC hdc,
DWORD dwCompression,
DWORD dwRedMask,
DWORD dwGreenMask,
DWORD dwBlueMask,
DWORD dwWidth,
DWORD dwHeight,
DWORD dwDCICaps,
DWORD dwBitCount,
DCIOFFSCREEN** lplpSurface
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hdc | HDC | in |
| dwCompression | DWORD | in |
| dwRedMask | DWORD | in |
| dwGreenMask | DWORD | in |
| dwBlueMask | DWORD | in |
| dwWidth | DWORD | in |
| dwHeight | DWORD | in |
| dwDCICaps | DWORD | in |
| dwBitCount | DWORD | in |
| lplpSurface | DCIOFFSCREEN** | inout |
戻り値の型: INT
各言語での呼び出し定義
// DCIMAN32.dll
#include <windows.h>
INT DCICreateOffscreen(
HDC hdc,
DWORD dwCompression,
DWORD dwRedMask,
DWORD dwGreenMask,
DWORD dwBlueMask,
DWORD dwWidth,
DWORD dwHeight,
DWORD dwDCICaps,
DWORD dwBitCount,
DCIOFFSCREEN** lplpSurface
);[DllImport("DCIMAN32.dll", ExactSpelling = true)]
static extern int DCICreateOffscreen(
IntPtr hdc, // HDC
uint dwCompression, // DWORD
uint dwRedMask, // DWORD
uint dwGreenMask, // DWORD
uint dwBlueMask, // DWORD
uint dwWidth, // DWORD
uint dwHeight, // DWORD
uint dwDCICaps, // DWORD
uint dwBitCount, // DWORD
IntPtr lplpSurface // DCIOFFSCREEN** in/out
);<DllImport("DCIMAN32.dll", ExactSpelling:=True)>
Public Shared Function DCICreateOffscreen(
hdc As IntPtr, ' HDC
dwCompression As UInteger, ' DWORD
dwRedMask As UInteger, ' DWORD
dwGreenMask As UInteger, ' DWORD
dwBlueMask As UInteger, ' DWORD
dwWidth As UInteger, ' DWORD
dwHeight As UInteger, ' DWORD
dwDCICaps As UInteger, ' DWORD
dwBitCount As UInteger, ' DWORD
lplpSurface As IntPtr ' DCIOFFSCREEN** in/out
) As Integer
End Function' hdc : HDC
' dwCompression : DWORD
' dwRedMask : DWORD
' dwGreenMask : DWORD
' dwBlueMask : DWORD
' dwWidth : DWORD
' dwHeight : DWORD
' dwDCICaps : DWORD
' dwBitCount : DWORD
' lplpSurface : DCIOFFSCREEN** in/out
Declare PtrSafe Function DCICreateOffscreen Lib "dciman32" ( _
ByVal hdc As LongPtr, _
ByVal dwCompression As Long, _
ByVal dwRedMask As Long, _
ByVal dwGreenMask As Long, _
ByVal dwBlueMask As Long, _
ByVal dwWidth As Long, _
ByVal dwHeight As Long, _
ByVal dwDCICaps As Long, _
ByVal dwBitCount As Long, _
ByVal lplpSurface As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DCICreateOffscreen = ctypes.windll.dciman32.DCICreateOffscreen
DCICreateOffscreen.restype = ctypes.c_int
DCICreateOffscreen.argtypes = [
wintypes.HANDLE, # hdc : HDC
wintypes.DWORD, # dwCompression : DWORD
wintypes.DWORD, # dwRedMask : DWORD
wintypes.DWORD, # dwGreenMask : DWORD
wintypes.DWORD, # dwBlueMask : DWORD
wintypes.DWORD, # dwWidth : DWORD
wintypes.DWORD, # dwHeight : DWORD
wintypes.DWORD, # dwDCICaps : DWORD
wintypes.DWORD, # dwBitCount : DWORD
ctypes.c_void_p, # lplpSurface : DCIOFFSCREEN** in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('DCIMAN32.dll')
DCICreateOffscreen = Fiddle::Function.new(
lib['DCICreateOffscreen'],
[
Fiddle::TYPE_VOIDP, # hdc : HDC
-Fiddle::TYPE_INT, # dwCompression : DWORD
-Fiddle::TYPE_INT, # dwRedMask : DWORD
-Fiddle::TYPE_INT, # dwGreenMask : DWORD
-Fiddle::TYPE_INT, # dwBlueMask : DWORD
-Fiddle::TYPE_INT, # dwWidth : DWORD
-Fiddle::TYPE_INT, # dwHeight : DWORD
-Fiddle::TYPE_INT, # dwDCICaps : DWORD
-Fiddle::TYPE_INT, # dwBitCount : DWORD
Fiddle::TYPE_VOIDP, # lplpSurface : DCIOFFSCREEN** in/out
],
Fiddle::TYPE_INT)#[link(name = "dciman32")]
extern "system" {
fn DCICreateOffscreen(
hdc: *mut core::ffi::c_void, // HDC
dwCompression: u32, // DWORD
dwRedMask: u32, // DWORD
dwGreenMask: u32, // DWORD
dwBlueMask: u32, // DWORD
dwWidth: u32, // DWORD
dwHeight: u32, // DWORD
dwDCICaps: u32, // DWORD
dwBitCount: u32, // DWORD
lplpSurface: *mut *mut DCIOFFSCREEN // DCIOFFSCREEN** in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("DCIMAN32.dll")]
public static extern int DCICreateOffscreen(IntPtr hdc, uint dwCompression, uint dwRedMask, uint dwGreenMask, uint dwBlueMask, uint dwWidth, uint dwHeight, uint dwDCICaps, uint dwBitCount, IntPtr lplpSurface);
"@
$api = Add-Type -MemberDefinition $sig -Name 'DCIMAN32_DCICreateOffscreen' -Namespace Win32 -PassThru
# $api::DCICreateOffscreen(hdc, dwCompression, dwRedMask, dwGreenMask, dwBlueMask, dwWidth, dwHeight, dwDCICaps, dwBitCount, lplpSurface)#uselib "DCIMAN32.dll"
#func global DCICreateOffscreen "DCICreateOffscreen" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; DCICreateOffscreen hdc, dwCompression, dwRedMask, dwGreenMask, dwBlueMask, dwWidth, dwHeight, dwDCICaps, dwBitCount, varptr(lplpSurface) ; 戻り値は stat
; hdc : HDC -> "sptr"
; dwCompression : DWORD -> "sptr"
; dwRedMask : DWORD -> "sptr"
; dwGreenMask : DWORD -> "sptr"
; dwBlueMask : DWORD -> "sptr"
; dwWidth : DWORD -> "sptr"
; dwHeight : DWORD -> "sptr"
; dwDCICaps : DWORD -> "sptr"
; dwBitCount : DWORD -> "sptr"
; lplpSurface : DCIOFFSCREEN** in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "DCIMAN32.dll" #cfunc global DCICreateOffscreen "DCICreateOffscreen" sptr, int, int, int, int, int, int, int, int, var ; res = DCICreateOffscreen(hdc, dwCompression, dwRedMask, dwGreenMask, dwBlueMask, dwWidth, dwHeight, dwDCICaps, dwBitCount, lplpSurface) ; hdc : HDC -> "sptr" ; dwCompression : DWORD -> "int" ; dwRedMask : DWORD -> "int" ; dwGreenMask : DWORD -> "int" ; dwBlueMask : DWORD -> "int" ; dwWidth : DWORD -> "int" ; dwHeight : DWORD -> "int" ; dwDCICaps : DWORD -> "int" ; dwBitCount : DWORD -> "int" ; lplpSurface : DCIOFFSCREEN** in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "DCIMAN32.dll" #cfunc global DCICreateOffscreen "DCICreateOffscreen" sptr, int, int, int, int, int, int, int, int, sptr ; res = DCICreateOffscreen(hdc, dwCompression, dwRedMask, dwGreenMask, dwBlueMask, dwWidth, dwHeight, dwDCICaps, dwBitCount, varptr(lplpSurface)) ; hdc : HDC -> "sptr" ; dwCompression : DWORD -> "int" ; dwRedMask : DWORD -> "int" ; dwGreenMask : DWORD -> "int" ; dwBlueMask : DWORD -> "int" ; dwWidth : DWORD -> "int" ; dwHeight : DWORD -> "int" ; dwDCICaps : DWORD -> "int" ; dwBitCount : DWORD -> "int" ; lplpSurface : DCIOFFSCREEN** in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT DCICreateOffscreen(HDC hdc, DWORD dwCompression, DWORD dwRedMask, DWORD dwGreenMask, DWORD dwBlueMask, DWORD dwWidth, DWORD dwHeight, DWORD dwDCICaps, DWORD dwBitCount, DCIOFFSCREEN** lplpSurface) #uselib "DCIMAN32.dll" #cfunc global DCICreateOffscreen "DCICreateOffscreen" intptr, int, int, int, int, int, int, int, int, var ; res = DCICreateOffscreen(hdc, dwCompression, dwRedMask, dwGreenMask, dwBlueMask, dwWidth, dwHeight, dwDCICaps, dwBitCount, lplpSurface) ; hdc : HDC -> "intptr" ; dwCompression : DWORD -> "int" ; dwRedMask : DWORD -> "int" ; dwGreenMask : DWORD -> "int" ; dwBlueMask : DWORD -> "int" ; dwWidth : DWORD -> "int" ; dwHeight : DWORD -> "int" ; dwDCICaps : DWORD -> "int" ; dwBitCount : DWORD -> "int" ; lplpSurface : DCIOFFSCREEN** in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT DCICreateOffscreen(HDC hdc, DWORD dwCompression, DWORD dwRedMask, DWORD dwGreenMask, DWORD dwBlueMask, DWORD dwWidth, DWORD dwHeight, DWORD dwDCICaps, DWORD dwBitCount, DCIOFFSCREEN** lplpSurface) #uselib "DCIMAN32.dll" #cfunc global DCICreateOffscreen "DCICreateOffscreen" intptr, int, int, int, int, int, int, int, int, intptr ; res = DCICreateOffscreen(hdc, dwCompression, dwRedMask, dwGreenMask, dwBlueMask, dwWidth, dwHeight, dwDCICaps, dwBitCount, varptr(lplpSurface)) ; hdc : HDC -> "intptr" ; dwCompression : DWORD -> "int" ; dwRedMask : DWORD -> "int" ; dwGreenMask : DWORD -> "int" ; dwBlueMask : DWORD -> "int" ; dwWidth : DWORD -> "int" ; dwHeight : DWORD -> "int" ; dwDCICaps : DWORD -> "int" ; dwBitCount : DWORD -> "int" ; lplpSurface : DCIOFFSCREEN** in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
dciman32 = windows.NewLazySystemDLL("DCIMAN32.dll")
procDCICreateOffscreen = dciman32.NewProc("DCICreateOffscreen")
)
// hdc (HDC), dwCompression (DWORD), dwRedMask (DWORD), dwGreenMask (DWORD), dwBlueMask (DWORD), dwWidth (DWORD), dwHeight (DWORD), dwDCICaps (DWORD), dwBitCount (DWORD), lplpSurface (DCIOFFSCREEN** in/out)
r1, _, err := procDCICreateOffscreen.Call(
uintptr(hdc),
uintptr(dwCompression),
uintptr(dwRedMask),
uintptr(dwGreenMask),
uintptr(dwBlueMask),
uintptr(dwWidth),
uintptr(dwHeight),
uintptr(dwDCICaps),
uintptr(dwBitCount),
uintptr(lplpSurface),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction DCICreateOffscreen(
hdc: THandle; // HDC
dwCompression: DWORD; // DWORD
dwRedMask: DWORD; // DWORD
dwGreenMask: DWORD; // DWORD
dwBlueMask: DWORD; // DWORD
dwWidth: DWORD; // DWORD
dwHeight: DWORD; // DWORD
dwDCICaps: DWORD; // DWORD
dwBitCount: DWORD; // DWORD
lplpSurface: Pointer // DCIOFFSCREEN** in/out
): Integer; stdcall;
external 'DCIMAN32.dll' name 'DCICreateOffscreen';result := DllCall("DCIMAN32\DCICreateOffscreen"
, "Ptr", hdc ; HDC
, "UInt", dwCompression ; DWORD
, "UInt", dwRedMask ; DWORD
, "UInt", dwGreenMask ; DWORD
, "UInt", dwBlueMask ; DWORD
, "UInt", dwWidth ; DWORD
, "UInt", dwHeight ; DWORD
, "UInt", dwDCICaps ; DWORD
, "UInt", dwBitCount ; DWORD
, "Ptr", lplpSurface ; DCIOFFSCREEN** in/out
, "Int") ; return: INT●DCICreateOffscreen(hdc, dwCompression, dwRedMask, dwGreenMask, dwBlueMask, dwWidth, dwHeight, dwDCICaps, dwBitCount, lplpSurface) = DLL("DCIMAN32.dll", "int DCICreateOffscreen(void*, dword, dword, dword, dword, dword, dword, dword, dword, void*)")
# 呼び出し: DCICreateOffscreen(hdc, dwCompression, dwRedMask, dwGreenMask, dwBlueMask, dwWidth, dwHeight, dwDCICaps, dwBitCount, lplpSurface)
# hdc : HDC -> "void*"
# dwCompression : DWORD -> "dword"
# dwRedMask : DWORD -> "dword"
# dwGreenMask : DWORD -> "dword"
# dwBlueMask : DWORD -> "dword"
# dwWidth : DWORD -> "dword"
# dwHeight : DWORD -> "dword"
# dwDCICaps : DWORD -> "dword"
# dwBitCount : DWORD -> "dword"
# lplpSurface : DCIOFFSCREEN** in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。