ホーム › UI.Controls › DlgDirListA
DlgDirListA
関数ディレクトリ内容をダイアログのリストボックスに一覧表示する(ANSI版)。
シグネチャ
// USER32.dll (ANSI / -A)
#include <windows.h>
INT DlgDirListA(
HWND hDlg,
LPSTR lpPathSpec,
INT nIDListBox,
INT nIDStaticPath,
DLG_DIR_LIST_FILE_TYPE uFileType
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hDlg | HWND | in |
| lpPathSpec | LPSTR | inout |
| nIDListBox | INT | in |
| nIDStaticPath | INT | in |
| uFileType | DLG_DIR_LIST_FILE_TYPE | in |
戻り値の型: INT
各言語での呼び出し定義
// USER32.dll (ANSI / -A)
#include <windows.h>
INT DlgDirListA(
HWND hDlg,
LPSTR lpPathSpec,
INT nIDListBox,
INT nIDStaticPath,
DLG_DIR_LIST_FILE_TYPE uFileType
);[DllImport("USER32.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern int DlgDirListA(
IntPtr hDlg, // HWND
[MarshalAs(UnmanagedType.LPStr)] System.Text.StringBuilder lpPathSpec, // LPSTR in/out
int nIDListBox, // INT
int nIDStaticPath, // INT
uint uFileType // DLG_DIR_LIST_FILE_TYPE
);<DllImport("USER32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function DlgDirListA(
hDlg As IntPtr, ' HWND
<MarshalAs(UnmanagedType.LPStr)> lpPathSpec As System.Text.StringBuilder, ' LPSTR in/out
nIDListBox As Integer, ' INT
nIDStaticPath As Integer, ' INT
uFileType As UInteger ' DLG_DIR_LIST_FILE_TYPE
) As Integer
End Function' hDlg : HWND
' lpPathSpec : LPSTR in/out
' nIDListBox : INT
' nIDStaticPath : INT
' uFileType : DLG_DIR_LIST_FILE_TYPE
Declare PtrSafe Function DlgDirListA Lib "user32" ( _
ByVal hDlg As LongPtr, _
ByVal lpPathSpec As String, _
ByVal nIDListBox As Long, _
ByVal nIDStaticPath As Long, _
ByVal uFileType As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DlgDirListA = ctypes.windll.user32.DlgDirListA
DlgDirListA.restype = ctypes.c_int
DlgDirListA.argtypes = [
wintypes.HANDLE, # hDlg : HWND
wintypes.LPSTR, # lpPathSpec : LPSTR in/out
ctypes.c_int, # nIDListBox : INT
ctypes.c_int, # nIDStaticPath : INT
wintypes.DWORD, # uFileType : DLG_DIR_LIST_FILE_TYPE
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('USER32.dll')
DlgDirListA = Fiddle::Function.new(
lib['DlgDirListA'],
[
Fiddle::TYPE_VOIDP, # hDlg : HWND
Fiddle::TYPE_VOIDP, # lpPathSpec : LPSTR in/out
Fiddle::TYPE_INT, # nIDListBox : INT
Fiddle::TYPE_INT, # nIDStaticPath : INT
-Fiddle::TYPE_INT, # uFileType : DLG_DIR_LIST_FILE_TYPE
],
Fiddle::TYPE_INT)#[link(name = "user32")]
extern "system" {
fn DlgDirListA(
hDlg: *mut core::ffi::c_void, // HWND
lpPathSpec: *mut u8, // LPSTR in/out
nIDListBox: i32, // INT
nIDStaticPath: i32, // INT
uFileType: u32 // DLG_DIR_LIST_FILE_TYPE
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("USER32.dll", CharSet = CharSet.Ansi)]
public static extern int DlgDirListA(IntPtr hDlg, [MarshalAs(UnmanagedType.LPStr)] System.Text.StringBuilder lpPathSpec, int nIDListBox, int nIDStaticPath, uint uFileType);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_DlgDirListA' -Namespace Win32 -PassThru
# $api::DlgDirListA(hDlg, lpPathSpec, nIDListBox, nIDStaticPath, uFileType)#uselib "USER32.dll"
#func global DlgDirListA "DlgDirListA" sptr, sptr, sptr, sptr, sptr
; DlgDirListA hDlg, varptr(lpPathSpec), nIDListBox, nIDStaticPath, uFileType ; 戻り値は stat
; hDlg : HWND -> "sptr"
; lpPathSpec : LPSTR in/out -> "sptr"
; nIDListBox : INT -> "sptr"
; nIDStaticPath : INT -> "sptr"
; uFileType : DLG_DIR_LIST_FILE_TYPE -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "USER32.dll" #cfunc global DlgDirListA "DlgDirListA" sptr, var, int, int, int ; res = DlgDirListA(hDlg, lpPathSpec, nIDListBox, nIDStaticPath, uFileType) ; hDlg : HWND -> "sptr" ; lpPathSpec : LPSTR in/out -> "var" ; nIDListBox : INT -> "int" ; nIDStaticPath : INT -> "int" ; uFileType : DLG_DIR_LIST_FILE_TYPE -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "USER32.dll" #cfunc global DlgDirListA "DlgDirListA" sptr, sptr, int, int, int ; res = DlgDirListA(hDlg, varptr(lpPathSpec), nIDListBox, nIDStaticPath, uFileType) ; hDlg : HWND -> "sptr" ; lpPathSpec : LPSTR in/out -> "sptr" ; nIDListBox : INT -> "int" ; nIDStaticPath : INT -> "int" ; uFileType : DLG_DIR_LIST_FILE_TYPE -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT DlgDirListA(HWND hDlg, LPSTR lpPathSpec, INT nIDListBox, INT nIDStaticPath, DLG_DIR_LIST_FILE_TYPE uFileType) #uselib "USER32.dll" #cfunc global DlgDirListA "DlgDirListA" intptr, var, int, int, int ; res = DlgDirListA(hDlg, lpPathSpec, nIDListBox, nIDStaticPath, uFileType) ; hDlg : HWND -> "intptr" ; lpPathSpec : LPSTR in/out -> "var" ; nIDListBox : INT -> "int" ; nIDStaticPath : INT -> "int" ; uFileType : DLG_DIR_LIST_FILE_TYPE -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT DlgDirListA(HWND hDlg, LPSTR lpPathSpec, INT nIDListBox, INT nIDStaticPath, DLG_DIR_LIST_FILE_TYPE uFileType) #uselib "USER32.dll" #cfunc global DlgDirListA "DlgDirListA" intptr, intptr, int, int, int ; res = DlgDirListA(hDlg, varptr(lpPathSpec), nIDListBox, nIDStaticPath, uFileType) ; hDlg : HWND -> "intptr" ; lpPathSpec : LPSTR in/out -> "intptr" ; nIDListBox : INT -> "int" ; nIDStaticPath : INT -> "int" ; uFileType : DLG_DIR_LIST_FILE_TYPE -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
user32 = windows.NewLazySystemDLL("USER32.dll")
procDlgDirListA = user32.NewProc("DlgDirListA")
)
// hDlg (HWND), lpPathSpec (LPSTR in/out), nIDListBox (INT), nIDStaticPath (INT), uFileType (DLG_DIR_LIST_FILE_TYPE)
r1, _, err := procDlgDirListA.Call(
uintptr(hDlg),
uintptr(lpPathSpec),
uintptr(nIDListBox),
uintptr(nIDStaticPath),
uintptr(uFileType),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction DlgDirListA(
hDlg: THandle; // HWND
lpPathSpec: PAnsiChar; // LPSTR in/out
nIDListBox: Integer; // INT
nIDStaticPath: Integer; // INT
uFileType: DWORD // DLG_DIR_LIST_FILE_TYPE
): Integer; stdcall;
external 'USER32.dll' name 'DlgDirListA';result := DllCall("USER32\DlgDirListA"
, "Ptr", hDlg ; HWND
, "Ptr", lpPathSpec ; LPSTR in/out
, "Int", nIDListBox ; INT
, "Int", nIDStaticPath ; INT
, "UInt", uFileType ; DLG_DIR_LIST_FILE_TYPE
, "Int") ; return: INT●DlgDirListA(hDlg, lpPathSpec, nIDListBox, nIDStaticPath, uFileType) = DLL("USER32.dll", "int DlgDirListA(void*, char*, int, int, dword)")
# 呼び出し: DlgDirListA(hDlg, lpPathSpec, nIDListBox, nIDStaticPath, uFileType)
# hDlg : HWND -> "void*"
# lpPathSpec : LPSTR in/out -> "char*"
# nIDListBox : INT -> "int"
# nIDStaticPath : INT -> "int"
# uFileType : DLG_DIR_LIST_FILE_TYPE -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。