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

IsNetDrive

関数
指定ドライブがネットワークドライブかを判定する。
DLLSHELL32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

INT IsNetDrive(
    INT iDrive
);

パラメーター

名前方向
iDriveINTin

戻り値の型: INT

各言語での呼び出し定義

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

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

IsNetDrive = ctypes.windll.shell32.IsNetDrive
IsNetDrive.restype = ctypes.c_int
IsNetDrive.argtypes = [
    ctypes.c_int,  # iDrive : INT
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('SHELL32.dll')
IsNetDrive = Fiddle::Function.new(
  lib['IsNetDrive'],
  [
    Fiddle::TYPE_INT,  # iDrive : INT
  ],
  Fiddle::TYPE_INT)
#[link(name = "shell32")]
extern "system" {
    fn IsNetDrive(
        iDrive: i32  // INT
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("SHELL32.dll")]
public static extern int IsNetDrive(int iDrive);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHELL32_IsNetDrive' -Namespace Win32 -PassThru
# $api::IsNetDrive(iDrive)
#uselib "SHELL32.dll"
#func global IsNetDrive "IsNetDrive" sptr
; IsNetDrive iDrive   ; 戻り値は stat
; iDrive : INT -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "SHELL32.dll"
#cfunc global IsNetDrive "IsNetDrive" int
; res = IsNetDrive(iDrive)
; iDrive : INT -> "int"
; INT IsNetDrive(INT iDrive)
#uselib "SHELL32.dll"
#cfunc global IsNetDrive "IsNetDrive" int
; res = IsNetDrive(iDrive)
; iDrive : INT -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	shell32 = windows.NewLazySystemDLL("SHELL32.dll")
	procIsNetDrive = shell32.NewProc("IsNetDrive")
)

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