ホーム › System.Memory › CreateMemoryResourceNotification
CreateMemoryResourceNotification
関数メモリリソース状態の通知オブジェクトを作成する。
シグネチャ
// KERNEL32.dll
#include <windows.h>
HANDLE CreateMemoryResourceNotification(
MEMORY_RESOURCE_NOTIFICATION_TYPE NotificationType
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| NotificationType | MEMORY_RESOURCE_NOTIFICATION_TYPE | in |
戻り値の型: HANDLE
各言語での呼び出し定義
// KERNEL32.dll
#include <windows.h>
HANDLE CreateMemoryResourceNotification(
MEMORY_RESOURCE_NOTIFICATION_TYPE NotificationType
);[DllImport("KERNEL32.dll", SetLastError = true, ExactSpelling = true)]
static extern IntPtr CreateMemoryResourceNotification(
int NotificationType // MEMORY_RESOURCE_NOTIFICATION_TYPE
);<DllImport("KERNEL32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function CreateMemoryResourceNotification(
NotificationType As Integer ' MEMORY_RESOURCE_NOTIFICATION_TYPE
) As IntPtr
End Function' NotificationType : MEMORY_RESOURCE_NOTIFICATION_TYPE
Declare PtrSafe Function CreateMemoryResourceNotification Lib "kernel32" ( _
ByVal NotificationType As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CreateMemoryResourceNotification = ctypes.windll.kernel32.CreateMemoryResourceNotification
CreateMemoryResourceNotification.restype = ctypes.c_void_p
CreateMemoryResourceNotification.argtypes = [
ctypes.c_int, # NotificationType : MEMORY_RESOURCE_NOTIFICATION_TYPE
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('KERNEL32.dll')
CreateMemoryResourceNotification = Fiddle::Function.new(
lib['CreateMemoryResourceNotification'],
[
Fiddle::TYPE_INT, # NotificationType : MEMORY_RESOURCE_NOTIFICATION_TYPE
],
Fiddle::TYPE_VOIDP)#[link(name = "kernel32")]
extern "system" {
fn CreateMemoryResourceNotification(
NotificationType: i32 // MEMORY_RESOURCE_NOTIFICATION_TYPE
) -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("KERNEL32.dll", SetLastError = true)]
public static extern IntPtr CreateMemoryResourceNotification(int NotificationType);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_CreateMemoryResourceNotification' -Namespace Win32 -PassThru
# $api::CreateMemoryResourceNotification(NotificationType)#uselib "KERNEL32.dll"
#func global CreateMemoryResourceNotification "CreateMemoryResourceNotification" sptr
; CreateMemoryResourceNotification NotificationType ; 戻り値は stat
; NotificationType : MEMORY_RESOURCE_NOTIFICATION_TYPE -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "KERNEL32.dll"
#cfunc global CreateMemoryResourceNotification "CreateMemoryResourceNotification" int
; res = CreateMemoryResourceNotification(NotificationType)
; NotificationType : MEMORY_RESOURCE_NOTIFICATION_TYPE -> "int"; HANDLE CreateMemoryResourceNotification(MEMORY_RESOURCE_NOTIFICATION_TYPE NotificationType)
#uselib "KERNEL32.dll"
#cfunc global CreateMemoryResourceNotification "CreateMemoryResourceNotification" int
; res = CreateMemoryResourceNotification(NotificationType)
; NotificationType : MEMORY_RESOURCE_NOTIFICATION_TYPE -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
procCreateMemoryResourceNotification = kernel32.NewProc("CreateMemoryResourceNotification")
)
// NotificationType (MEMORY_RESOURCE_NOTIFICATION_TYPE)
r1, _, err := procCreateMemoryResourceNotification.Call(
uintptr(NotificationType),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HANDLEfunction CreateMemoryResourceNotification(
NotificationType: Integer // MEMORY_RESOURCE_NOTIFICATION_TYPE
): THandle; stdcall;
external 'KERNEL32.dll' name 'CreateMemoryResourceNotification';result := DllCall("KERNEL32\CreateMemoryResourceNotification"
, "Int", NotificationType ; MEMORY_RESOURCE_NOTIFICATION_TYPE
, "Ptr") ; return: HANDLE●CreateMemoryResourceNotification(NotificationType) = DLL("KERNEL32.dll", "void* CreateMemoryResourceNotification(int)")
# 呼び出し: CreateMemoryResourceNotification(NotificationType)
# NotificationType : MEMORY_RESOURCE_NOTIFICATION_TYPE -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。