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