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

HcsCreateOperationWithNotifications

関数
通知付きのHCS操作を作成する。
DLLcomputecore.dll呼出規約winapi

シグネチャ

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

HCS_OPERATION HcsCreateOperationWithNotifications(
    HCS_OPERATION_OPTIONS eventTypes,
    const void* context,   // optional
    HCS_EVENT_CALLBACK callback
);

パラメーター

名前方向
eventTypesHCS_OPERATION_OPTIONSin
contextvoid*inoptional
callbackHCS_EVENT_CALLBACKin

戻り値の型: HCS_OPERATION

各言語での呼び出し定義

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

HCS_OPERATION HcsCreateOperationWithNotifications(
    HCS_OPERATION_OPTIONS eventTypes,
    const void* context,   // optional
    HCS_EVENT_CALLBACK callback
);
[DllImport("computecore.dll", ExactSpelling = true)]
static extern IntPtr HcsCreateOperationWithNotifications(
    int eventTypes,   // HCS_OPERATION_OPTIONS
    IntPtr context,   // void* optional
    IntPtr callback   // HCS_EVENT_CALLBACK
);
<DllImport("computecore.dll", ExactSpelling:=True)>
Public Shared Function HcsCreateOperationWithNotifications(
    eventTypes As Integer,   ' HCS_OPERATION_OPTIONS
    context As IntPtr,   ' void* optional
    callback As IntPtr   ' HCS_EVENT_CALLBACK
) As IntPtr
End Function
' eventTypes : HCS_OPERATION_OPTIONS
' context : void* optional
' callback : HCS_EVENT_CALLBACK
Declare PtrSafe Function HcsCreateOperationWithNotifications Lib "computecore" ( _
    ByVal eventTypes As Long, _
    ByVal context As LongPtr, _
    ByVal callback As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

HcsCreateOperationWithNotifications = ctypes.windll.computecore.HcsCreateOperationWithNotifications
HcsCreateOperationWithNotifications.restype = ctypes.c_void_p
HcsCreateOperationWithNotifications.argtypes = [
    ctypes.c_int,  # eventTypes : HCS_OPERATION_OPTIONS
    ctypes.POINTER(None),  # context : void* optional
    ctypes.c_void_p,  # callback : HCS_EVENT_CALLBACK
]
require 'fiddle'
require 'fiddle/import'

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

var (
	computecore = windows.NewLazySystemDLL("computecore.dll")
	procHcsCreateOperationWithNotifications = computecore.NewProc("HcsCreateOperationWithNotifications")
)

// eventTypes (HCS_OPERATION_OPTIONS), context (void* optional), callback (HCS_EVENT_CALLBACK)
r1, _, err := procHcsCreateOperationWithNotifications.Call(
	uintptr(eventTypes),
	uintptr(context),
	uintptr(callback),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HCS_OPERATION
function HcsCreateOperationWithNotifications(
  eventTypes: Integer;   // HCS_OPERATION_OPTIONS
  context: Pointer;   // void* optional
  callback: Pointer   // HCS_EVENT_CALLBACK
): THandle; stdcall;
  external 'computecore.dll' name 'HcsCreateOperationWithNotifications';
result := DllCall("computecore\HcsCreateOperationWithNotifications"
    , "Int", eventTypes   ; HCS_OPERATION_OPTIONS
    , "Ptr", context   ; void* optional
    , "Ptr", callback   ; HCS_EVENT_CALLBACK
    , "Ptr")   ; return: HCS_OPERATION
●HcsCreateOperationWithNotifications(eventTypes, context, callback) = DLL("computecore.dll", "void* HcsCreateOperationWithNotifications(int, void*, void*)")
# 呼び出し: HcsCreateOperationWithNotifications(eventTypes, context, callback)
# eventTypes : HCS_OPERATION_OPTIONS -> "int"
# context : void* optional -> "void*"
# callback : HCS_EVENT_CALLBACK -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。