Win32 API 日本語リファレンス
ホームUI.Shell › SHFree

SHFree

関数
シェルアロケーターで確保したメモリを解放する。
DLLSHELL32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

void SHFree(
    void* pv   // optional
);

パラメーター

名前方向
pvvoid*inoptional

戻り値の型: void

各言語での呼び出し定義

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

void SHFree(
    void* pv   // optional
);
[DllImport("SHELL32.dll", ExactSpelling = true)]
static extern void SHFree(
    IntPtr pv   // void* optional
);
<DllImport("SHELL32.dll", ExactSpelling:=True)>
Public Shared Sub SHFree(
    pv As IntPtr   ' void* optional
)
End Sub
' pv : void* optional
Declare PtrSafe Sub SHFree Lib "shell32" ( _
    ByVal pv As LongPtr)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SHFree = ctypes.windll.shell32.SHFree
SHFree.restype = None
SHFree.argtypes = [
    ctypes.POINTER(None),  # pv : void* optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('SHELL32.dll')
SHFree = Fiddle::Function.new(
  lib['SHFree'],
  [
    Fiddle::TYPE_VOIDP,  # pv : void* optional
  ],
  Fiddle::TYPE_VOID)
#[link(name = "shell32")]
extern "system" {
    fn SHFree(
        pv: *mut ()  // void* optional
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("SHELL32.dll")]
public static extern void SHFree(IntPtr pv);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHELL32_SHFree' -Namespace Win32 -PassThru
# $api::SHFree(pv)
#uselib "SHELL32.dll"
#func global SHFree "SHFree" sptr
; SHFree pv
; pv : void* optional -> "sptr"
#uselib "SHELL32.dll"
#func global SHFree "SHFree" sptr
; SHFree pv
; pv : void* optional -> "sptr"
; void SHFree(void* pv)
#uselib "SHELL32.dll"
#func global SHFree "SHFree" intptr
; SHFree pv
; pv : void* optional -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	shell32 = windows.NewLazySystemDLL("SHELL32.dll")
	procSHFree = shell32.NewProc("SHFree")
)

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