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

GlobalUnWire

関数
グローバルメモリブロックのロックを解除する旧式関数。
DLLKERNEL32.dll呼出規約winapi

シグネチャ

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

BOOL GlobalUnWire(
    HGLOBAL hMem
);

パラメーター

名前方向
hMemHGLOBALin

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL GlobalUnWire(
    HGLOBAL hMem
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", ExactSpelling = true)]
static extern bool GlobalUnWire(
    IntPtr hMem   // HGLOBAL
);
<DllImport("KERNEL32.dll", ExactSpelling:=True)>
Public Shared Function GlobalUnWire(
    hMem As IntPtr   ' HGLOBAL
) As Boolean
End Function
' hMem : HGLOBAL
Declare PtrSafe Function GlobalUnWire Lib "kernel32" ( _
    ByVal hMem As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GlobalUnWire = ctypes.windll.kernel32.GlobalUnWire
GlobalUnWire.restype = wintypes.BOOL
GlobalUnWire.argtypes = [
    wintypes.HANDLE,  # hMem : HGLOBAL
]
require 'fiddle'
require 'fiddle/import'

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

var (
	kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
	procGlobalUnWire = kernel32.NewProc("GlobalUnWire")
)

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