Win32 API 日本語リファレンス
ホームDevices.Display › EngLockSurface

EngLockSurface

関数
サーフェスをロックしてサーフェスオブジェクトを取得する。
DLLGDI32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

SURFOBJ* EngLockSurface(
    HSURF hsurf
);

パラメーター

名前方向
hsurfHSURFin

戻り値の型: SURFOBJ*

各言語での呼び出し定義

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

SURFOBJ* EngLockSurface(
    HSURF hsurf
);
[DllImport("GDI32.dll", ExactSpelling = true)]
static extern IntPtr EngLockSurface(
    IntPtr hsurf   // HSURF
);
<DllImport("GDI32.dll", ExactSpelling:=True)>
Public Shared Function EngLockSurface(
    hsurf As IntPtr   ' HSURF
) As IntPtr
End Function
' hsurf : HSURF
Declare PtrSafe Function EngLockSurface Lib "gdi32" ( _
    ByVal hsurf As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

EngLockSurface = ctypes.windll.gdi32.EngLockSurface
EngLockSurface.restype = ctypes.c_void_p
EngLockSurface.argtypes = [
    wintypes.HANDLE,  # hsurf : HSURF
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('GDI32.dll')
EngLockSurface = Fiddle::Function.new(
  lib['EngLockSurface'],
  [
    Fiddle::TYPE_VOIDP,  # hsurf : HSURF
  ],
  Fiddle::TYPE_VOIDP)
#[link(name = "gdi32")]
extern "system" {
    fn EngLockSurface(
        hsurf: *mut core::ffi::c_void  // HSURF
    ) -> *mut SURFOBJ;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("GDI32.dll")]
public static extern IntPtr EngLockSurface(IntPtr hsurf);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GDI32_EngLockSurface' -Namespace Win32 -PassThru
# $api::EngLockSurface(hsurf)
#uselib "GDI32.dll"
#func global EngLockSurface "EngLockSurface" sptr
; EngLockSurface hsurf   ; 戻り値は stat
; hsurf : HSURF -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "GDI32.dll"
#cfunc global EngLockSurface "EngLockSurface" sptr
; res = EngLockSurface(hsurf)
; hsurf : HSURF -> "sptr"
; SURFOBJ* EngLockSurface(HSURF hsurf)
#uselib "GDI32.dll"
#cfunc global EngLockSurface "EngLockSurface" intptr
; res = EngLockSurface(hsurf)
; hsurf : HSURF -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	gdi32 = windows.NewLazySystemDLL("GDI32.dll")
	procEngLockSurface = gdi32.NewProc("EngLockSurface")
)

// hsurf (HSURF)
r1, _, err := procEngLockSurface.Call(
	uintptr(hsurf),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // SURFOBJ*
function EngLockSurface(
  hsurf: THandle   // HSURF
): Pointer; stdcall;
  external 'GDI32.dll' name 'EngLockSurface';
result := DllCall("GDI32\EngLockSurface"
    , "Ptr", hsurf   ; HSURF
    , "Ptr")   ; return: SURFOBJ*
●EngLockSurface(hsurf) = DLL("GDI32.dll", "void* EngLockSurface(void*)")
# 呼び出し: EngLockSurface(hsurf)
# hsurf : HSURF -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。