PathIsUNCServerShareA
関数パスがUNCのサーバーと共有名のみかどうかを判定する。
シグネチャ
// SHLWAPI.dll (ANSI / -A)
#include <windows.h>
BOOL PathIsUNCServerShareA(
LPCSTR pszPath
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pszPath | LPCSTR | in |
戻り値の型: BOOL
各言語での呼び出し定義
// SHLWAPI.dll (ANSI / -A)
#include <windows.h>
BOOL PathIsUNCServerShareA(
LPCSTR pszPath
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SHLWAPI.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern bool PathIsUNCServerShareA(
[MarshalAs(UnmanagedType.LPStr)] string pszPath // LPCSTR
);<DllImport("SHLWAPI.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function PathIsUNCServerShareA(
<MarshalAs(UnmanagedType.LPStr)> pszPath As String ' LPCSTR
) As Boolean
End Function' pszPath : LPCSTR
Declare PtrSafe Function PathIsUNCServerShareA Lib "shlwapi" ( _
ByVal pszPath As String) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
PathIsUNCServerShareA = ctypes.windll.shlwapi.PathIsUNCServerShareA
PathIsUNCServerShareA.restype = wintypes.BOOL
PathIsUNCServerShareA.argtypes = [
wintypes.LPCSTR, # pszPath : LPCSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SHLWAPI.dll')
PathIsUNCServerShareA = Fiddle::Function.new(
lib['PathIsUNCServerShareA'],
[
Fiddle::TYPE_VOIDP, # pszPath : LPCSTR
],
Fiddle::TYPE_INT)#[link(name = "shlwapi")]
extern "system" {
fn PathIsUNCServerShareA(
pszPath: *const u8 // LPCSTR
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SHLWAPI.dll", CharSet = CharSet.Ansi)]
public static extern bool PathIsUNCServerShareA([MarshalAs(UnmanagedType.LPStr)] string pszPath);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHLWAPI_PathIsUNCServerShareA' -Namespace Win32 -PassThru
# $api::PathIsUNCServerShareA(pszPath)#uselib "SHLWAPI.dll"
#func global PathIsUNCServerShareA "PathIsUNCServerShareA" sptr
; PathIsUNCServerShareA pszPath ; 戻り値は stat
; pszPath : LPCSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "SHLWAPI.dll"
#cfunc global PathIsUNCServerShareA "PathIsUNCServerShareA" str
; res = PathIsUNCServerShareA(pszPath)
; pszPath : LPCSTR -> "str"; BOOL PathIsUNCServerShareA(LPCSTR pszPath)
#uselib "SHLWAPI.dll"
#cfunc global PathIsUNCServerShareA "PathIsUNCServerShareA" str
; res = PathIsUNCServerShareA(pszPath)
; pszPath : LPCSTR -> "str"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
shlwapi = windows.NewLazySystemDLL("SHLWAPI.dll")
procPathIsUNCServerShareA = shlwapi.NewProc("PathIsUNCServerShareA")
)
// pszPath (LPCSTR)
r1, _, err := procPathIsUNCServerShareA.Call(
uintptr(unsafe.Pointer(windows.BytePtrFromString(pszPath))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction PathIsUNCServerShareA(
pszPath: PAnsiChar // LPCSTR
): BOOL; stdcall;
external 'SHLWAPI.dll' name 'PathIsUNCServerShareA';result := DllCall("SHLWAPI\PathIsUNCServerShareA"
, "AStr", pszPath ; LPCSTR
, "Int") ; return: BOOL●PathIsUNCServerShareA(pszPath) = DLL("SHLWAPI.dll", "bool PathIsUNCServerShareA(char*)")
# 呼び出し: PathIsUNCServerShareA(pszPath)
# pszPath : LPCSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。