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