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

EngCreateSemaphore

関数
ドライバ用のセマフォを作成する。
DLLGDI32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

HSEMAPHORE EngCreateSemaphore(void);

パラメーターなし。戻り値: HSEMAPHORE

各言語での呼び出し定義

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

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

EngCreateSemaphore = ctypes.windll.gdi32.EngCreateSemaphore
EngCreateSemaphore.restype = ctypes.c_void_p
EngCreateSemaphore.argtypes = []
require 'fiddle'
require 'fiddle/import'

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

var (
	gdi32 = windows.NewLazySystemDLL("GDI32.dll")
	procEngCreateSemaphore = gdi32.NewProc("EngCreateSemaphore")
)

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