DriveType
関数指定ドライブの種類を取得する。
シグネチャ
// SHELL32.dll
#include <windows.h>
INT DriveType(
INT iDrive
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| iDrive | INT | in |
戻り値の型: INT
各言語での呼び出し定義
// SHELL32.dll
#include <windows.h>
INT DriveType(
INT iDrive
);[DllImport("SHELL32.dll", ExactSpelling = true)]
static extern int DriveType(
int iDrive // INT
);<DllImport("SHELL32.dll", ExactSpelling:=True)>
Public Shared Function DriveType(
iDrive As Integer ' INT
) As Integer
End Function' iDrive : INT
Declare PtrSafe Function DriveType 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
DriveType = ctypes.windll.shell32.DriveType
DriveType.restype = ctypes.c_int
DriveType.argtypes = [
ctypes.c_int, # iDrive : INT
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SHELL32.dll')
DriveType = Fiddle::Function.new(
lib['DriveType'],
[
Fiddle::TYPE_INT, # iDrive : INT
],
Fiddle::TYPE_INT)#[link(name = "shell32")]
extern "system" {
fn DriveType(
iDrive: i32 // INT
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("SHELL32.dll")]
public static extern int DriveType(int iDrive);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHELL32_DriveType' -Namespace Win32 -PassThru
# $api::DriveType(iDrive)#uselib "SHELL32.dll"
#func global DriveType "DriveType" sptr
; DriveType iDrive ; 戻り値は stat
; iDrive : INT -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "SHELL32.dll"
#cfunc global DriveType "DriveType" int
; res = DriveType(iDrive)
; iDrive : INT -> "int"; INT DriveType(INT iDrive)
#uselib "SHELL32.dll"
#cfunc global DriveType "DriveType" int
; res = DriveType(iDrive)
; iDrive : INT -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
shell32 = windows.NewLazySystemDLL("SHELL32.dll")
procDriveType = shell32.NewProc("DriveType")
)
// iDrive (INT)
r1, _, err := procDriveType.Call(
uintptr(iDrive),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction DriveType(
iDrive: Integer // INT
): Integer; stdcall;
external 'SHELL32.dll' name 'DriveType';result := DllCall("SHELL32\DriveType"
, "Int", iDrive ; INT
, "Int") ; return: INT●DriveType(iDrive) = DLL("SHELL32.dll", "int DriveType(int)")
# 呼び出し: DriveType(iDrive)
# iDrive : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。