PathIsSlowW
関数指定パス(Unicode)が低速な媒体上にあるかを判定する。
シグネチャ
// SHELL32.dll (Unicode / -W)
#include <windows.h>
BOOL PathIsSlowW(
LPCWSTR pszFile,
DWORD dwAttr
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pszFile | LPCWSTR | in |
| dwAttr | DWORD | in |
戻り値の型: BOOL
各言語での呼び出し定義
// SHELL32.dll (Unicode / -W)
#include <windows.h>
BOOL PathIsSlowW(
LPCWSTR pszFile,
DWORD dwAttr
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SHELL32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern bool PathIsSlowW(
[MarshalAs(UnmanagedType.LPWStr)] string pszFile, // LPCWSTR
uint dwAttr // DWORD
);<DllImport("SHELL32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function PathIsSlowW(
<MarshalAs(UnmanagedType.LPWStr)> pszFile As String, ' LPCWSTR
dwAttr As UInteger ' DWORD
) As Boolean
End Function' pszFile : LPCWSTR
' dwAttr : DWORD
Declare PtrSafe Function PathIsSlowW Lib "shell32" ( _
ByVal pszFile As LongPtr, _
ByVal dwAttr As Long) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
PathIsSlowW = ctypes.windll.shell32.PathIsSlowW
PathIsSlowW.restype = wintypes.BOOL
PathIsSlowW.argtypes = [
wintypes.LPCWSTR, # pszFile : LPCWSTR
wintypes.DWORD, # dwAttr : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SHELL32.dll')
PathIsSlowW = Fiddle::Function.new(
lib['PathIsSlowW'],
[
Fiddle::TYPE_VOIDP, # pszFile : LPCWSTR
-Fiddle::TYPE_INT, # dwAttr : DWORD
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "shell32")]
extern "system" {
fn PathIsSlowW(
pszFile: *const u16, // LPCWSTR
dwAttr: u32 // DWORD
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SHELL32.dll", CharSet = CharSet.Unicode)]
public static extern bool PathIsSlowW([MarshalAs(UnmanagedType.LPWStr)] string pszFile, uint dwAttr);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHELL32_PathIsSlowW' -Namespace Win32 -PassThru
# $api::PathIsSlowW(pszFile, dwAttr)#uselib "SHELL32.dll"
#func global PathIsSlowW "PathIsSlowW" wptr, wptr
; PathIsSlowW pszFile, dwAttr ; 戻り値は stat
; pszFile : LPCWSTR -> "wptr"
; dwAttr : DWORD -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "SHELL32.dll"
#cfunc global PathIsSlowW "PathIsSlowW" wstr, int
; res = PathIsSlowW(pszFile, dwAttr)
; pszFile : LPCWSTR -> "wstr"
; dwAttr : DWORD -> "int"; BOOL PathIsSlowW(LPCWSTR pszFile, DWORD dwAttr)
#uselib "SHELL32.dll"
#cfunc global PathIsSlowW "PathIsSlowW" wstr, int
; res = PathIsSlowW(pszFile, dwAttr)
; pszFile : LPCWSTR -> "wstr"
; dwAttr : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
shell32 = windows.NewLazySystemDLL("SHELL32.dll")
procPathIsSlowW = shell32.NewProc("PathIsSlowW")
)
// pszFile (LPCWSTR), dwAttr (DWORD)
r1, _, err := procPathIsSlowW.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszFile))),
uintptr(dwAttr),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction PathIsSlowW(
pszFile: PWideChar; // LPCWSTR
dwAttr: DWORD // DWORD
): BOOL; stdcall;
external 'SHELL32.dll' name 'PathIsSlowW';result := DllCall("SHELL32\PathIsSlowW"
, "WStr", pszFile ; LPCWSTR
, "UInt", dwAttr ; DWORD
, "Int") ; return: BOOL●PathIsSlowW(pszFile, dwAttr) = DLL("SHELL32.dll", "bool PathIsSlowW(char*, dword)")
# 呼び出し: PathIsSlowW(pszFile, dwAttr)
# pszFile : LPCWSTR -> "char*"
# dwAttr : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。