SHQueryRecycleBinA
関数ごみ箱内の項目数と合計サイズを取得する。
シグネチャ
// SHELL32.dll (ANSI / -A)
#include <windows.h>
HRESULT SHQueryRecycleBinA(
LPCSTR pszRootPath, // optional
SHQUERYRBINFO* pSHQueryRBInfo
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pszRootPath | LPCSTR | inoptional |
| pSHQueryRBInfo | SHQUERYRBINFO* | inout |
戻り値の型: HRESULT
各言語での呼び出し定義
// SHELL32.dll (ANSI / -A)
#include <windows.h>
HRESULT SHQueryRecycleBinA(
LPCSTR pszRootPath, // optional
SHQUERYRBINFO* pSHQueryRBInfo
);[DllImport("SHELL32.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern int SHQueryRecycleBinA(
[MarshalAs(UnmanagedType.LPStr)] string pszRootPath, // LPCSTR optional
IntPtr pSHQueryRBInfo // SHQUERYRBINFO* in/out
);<DllImport("SHELL32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function SHQueryRecycleBinA(
<MarshalAs(UnmanagedType.LPStr)> pszRootPath As String, ' LPCSTR optional
pSHQueryRBInfo As IntPtr ' SHQUERYRBINFO* in/out
) As Integer
End Function' pszRootPath : LPCSTR optional
' pSHQueryRBInfo : SHQUERYRBINFO* in/out
Declare PtrSafe Function SHQueryRecycleBinA Lib "shell32" ( _
ByVal pszRootPath As String, _
ByVal pSHQueryRBInfo As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SHQueryRecycleBinA = ctypes.windll.shell32.SHQueryRecycleBinA
SHQueryRecycleBinA.restype = ctypes.c_int
SHQueryRecycleBinA.argtypes = [
wintypes.LPCSTR, # pszRootPath : LPCSTR optional
ctypes.c_void_p, # pSHQueryRBInfo : SHQUERYRBINFO* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SHELL32.dll')
SHQueryRecycleBinA = Fiddle::Function.new(
lib['SHQueryRecycleBinA'],
[
Fiddle::TYPE_VOIDP, # pszRootPath : LPCSTR optional
Fiddle::TYPE_VOIDP, # pSHQueryRBInfo : SHQUERYRBINFO* in/out
],
Fiddle::TYPE_INT)#[link(name = "shell32")]
extern "system" {
fn SHQueryRecycleBinA(
pszRootPath: *const u8, // LPCSTR optional
pSHQueryRBInfo: *mut SHQUERYRBINFO // SHQUERYRBINFO* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("SHELL32.dll", CharSet = CharSet.Ansi)]
public static extern int SHQueryRecycleBinA([MarshalAs(UnmanagedType.LPStr)] string pszRootPath, IntPtr pSHQueryRBInfo);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHELL32_SHQueryRecycleBinA' -Namespace Win32 -PassThru
# $api::SHQueryRecycleBinA(pszRootPath, pSHQueryRBInfo)#uselib "SHELL32.dll"
#func global SHQueryRecycleBinA "SHQueryRecycleBinA" sptr, sptr
; SHQueryRecycleBinA pszRootPath, varptr(pSHQueryRBInfo) ; 戻り値は stat
; pszRootPath : LPCSTR optional -> "sptr"
; pSHQueryRBInfo : SHQUERYRBINFO* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "SHELL32.dll" #cfunc global SHQueryRecycleBinA "SHQueryRecycleBinA" str, var ; res = SHQueryRecycleBinA(pszRootPath, pSHQueryRBInfo) ; pszRootPath : LPCSTR optional -> "str" ; pSHQueryRBInfo : SHQUERYRBINFO* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "SHELL32.dll" #cfunc global SHQueryRecycleBinA "SHQueryRecycleBinA" str, sptr ; res = SHQueryRecycleBinA(pszRootPath, varptr(pSHQueryRBInfo)) ; pszRootPath : LPCSTR optional -> "str" ; pSHQueryRBInfo : SHQUERYRBINFO* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT SHQueryRecycleBinA(LPCSTR pszRootPath, SHQUERYRBINFO* pSHQueryRBInfo) #uselib "SHELL32.dll" #cfunc global SHQueryRecycleBinA "SHQueryRecycleBinA" str, var ; res = SHQueryRecycleBinA(pszRootPath, pSHQueryRBInfo) ; pszRootPath : LPCSTR optional -> "str" ; pSHQueryRBInfo : SHQUERYRBINFO* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT SHQueryRecycleBinA(LPCSTR pszRootPath, SHQUERYRBINFO* pSHQueryRBInfo) #uselib "SHELL32.dll" #cfunc global SHQueryRecycleBinA "SHQueryRecycleBinA" str, intptr ; res = SHQueryRecycleBinA(pszRootPath, varptr(pSHQueryRBInfo)) ; pszRootPath : LPCSTR optional -> "str" ; pSHQueryRBInfo : SHQUERYRBINFO* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
shell32 = windows.NewLazySystemDLL("SHELL32.dll")
procSHQueryRecycleBinA = shell32.NewProc("SHQueryRecycleBinA")
)
// pszRootPath (LPCSTR optional), pSHQueryRBInfo (SHQUERYRBINFO* in/out)
r1, _, err := procSHQueryRecycleBinA.Call(
uintptr(unsafe.Pointer(windows.BytePtrFromString(pszRootPath))),
uintptr(pSHQueryRBInfo),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction SHQueryRecycleBinA(
pszRootPath: PAnsiChar; // LPCSTR optional
pSHQueryRBInfo: Pointer // SHQUERYRBINFO* in/out
): Integer; stdcall;
external 'SHELL32.dll' name 'SHQueryRecycleBinA';result := DllCall("SHELL32\SHQueryRecycleBinA"
, "AStr", pszRootPath ; LPCSTR optional
, "Ptr", pSHQueryRBInfo ; SHQUERYRBINFO* in/out
, "Int") ; return: HRESULT●SHQueryRecycleBinA(pszRootPath, pSHQueryRBInfo) = DLL("SHELL32.dll", "int SHQueryRecycleBinA(char*, void*)")
# 呼び出し: SHQueryRecycleBinA(pszRootPath, pSHQueryRBInfo)
# pszRootPath : LPCSTR optional -> "char*"
# pSHQueryRBInfo : SHQUERYRBINFO* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。