DlgDirListComboBoxW
関数シグネチャ
// USER32.dll (Unicode / -W)
#include <windows.h>
INT DlgDirListComboBoxW(
HWND hDlg,
LPWSTR lpPathSpec,
INT nIDComboBox,
INT nIDStaticPath,
DLG_DIR_LIST_FILE_TYPE uFiletype
);パラメーター
| 名前 | 型 | 方向 | 説明 | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| hDlg | HWND | in | コンボボックスを含むダイアログボックスへのハンドルです。 | ||||||||||||||||||||
| lpPathSpec | LPWSTR | inout | 絶対パス、相対パス、またはファイル名を指定する null 終端文字列を格納したバッファーへのポインターです。絶対パスは、ドライブ文字(例: d:\)または UNC 名(例: \\machinename\sharename)で始めることができます。 この関数は文字列をディレクトリとファイル名に分割します。関数はそのディレクトリ内で、ファイル名に一致する名前を検索します。文字列がディレクトリを指定していない場合、関数は現在のディレクトリを検索します。 文字列にファイル名が含まれる場合、そのファイル名には少なくとも 1 つのワイルドカード文字(? または *)を含める必要があります。文字列にファイル名が含まれない場合、関数はファイル名としてアスタリスクのワイルドカード文字(*)が指定されたものとして動作します。指定されたディレクトリ内で、ファイル名に一致し、かつ uFiletype パラメーターで指定された属性を持つすべての名前が、コンボボックスに表示される一覧に追加されます。 | ||||||||||||||||||||
| nIDComboBox | INT | in | hDlg ダイアログボックス内のコンボボックスの識別子です。このパラメーターが 0 の場合、DlgDirListComboBox はコンボボックスへの設定を試みません。 | ||||||||||||||||||||
| nIDStaticPath | INT | in | hDlg ダイアログボックス内のスタティックコントロールの識別子です。DlgDirListComboBox は、現在のドライブとディレクトリを表示するようにこのコントロールのテキストを設定します。現在のドライブとディレクトリを表示したくない場合、このパラメーターは 0 にできます。 | ||||||||||||||||||||
| uFiletype | DLG_DIR_LIST_FILE_TYPE | in | コンボボックスに追加するファイルまたはディレクトリの属性を指定するビットフラグのセットです。このパラメーターには、次の値の組み合わせを指定できます。
|
戻り値の型: INT
公式ドキュメント
コンボボックスの内容を、指定したディレクトリ内のサブディレクトリ名とファイル名で置き換えます。ファイル属性のセットを指定することで、名前の一覧をフィルタリングできます。名前の一覧には、割り当て済みのドライブ文字を含めることができます。(Unicode)
戻り値
型: int
関数が成功した場合、戻り値は 0 以外になります。
関数が失敗した場合、戻り値は 0 になります。たとえば、lpPathSpec で指定された文字列が有効なパスでない場合、関数は失敗します。拡張エラー情報を取得するには、GetLastError を呼び出します。
解説(Remarks)
lpPathSpec がディレクトリを指定している場合、DlgDirListComboBox はコンボボックスに設定する前に、現在のディレクトリを指定されたディレクトリに変更します。nIDStaticPath パラメーターで識別されるスタティックコントロールのテキストは、新しい現在のディレクトリの名前に設定されます。
DlgDirListComboBox は、CB_RESETCONTENT メッセージと CB_DIR メッセージをコンボボックスに送信します。
Microsoft Windows NT 4.0 以降: uFiletype に DDL_DIRECTORY フラグが含まれており、かつ lpPathSpec が C:\TEMP のような第 1 レベルのディレクトリを指定している場合、コンボボックスには常にルートディレクトリを表す ".." エントリが含まれます。これは、ルートディレクトリに隠し属性やシステム属性があり、DDL_HIDDEN フラグや DDL_SYSTEM フラグが指定されていない場合でも同様です。NTFS ボリュームのルートディレクトリには、隠し属性とシステム属性があります。
セキュリティに関する警告: この関数を誤って使用すると、プログラムのセキュリティが損なわれる可能性があります。この関数の誤った使用には、lpPathSpec が書き込み不可のバッファーや null 終端のないバッファーを指すようにすることが含まれます。続行する前に、セキュリティに関する考慮事項: Microsoft Windows コントロール を確認してください。
Microsoft Windows NT 4.0 以降: 一覧には長いファイル名が表示されます(ある場合)。
Windows 95 以降: 一覧には短いファイル名(8.3 形式)が表示されます。対応する長いファイル名を取得するには、SHGetFileInfo 関数または GetFullPathName 関数を使用できます。
Windows 95 以降: DlgDirListComboBoxW は Microsoft Layer for Unicode によってサポートされています。これを使用するには、Microsoft Layer for Unicode on Windows Me/98/95 Systems で説明されているとおり、特定のファイルをアプリケーションに追加する必要があります。
winuser.h ヘッダーは、UNICODE プリプロセッサ定数の定義に基づいて、この関数の ANSI 版または Unicode 版を自動的に選択するエイリアスとして DlgDirListComboBox を定義します。エンコード非依存のエイリアスの使用を、エンコード非依存でないコードと混在させると、不整合が生じ、コンパイルエラーや実行時エラーが発生する可能性があります。詳細については、関数プロトタイプの規則 を参照してください。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// USER32.dll (Unicode / -W)
#include <windows.h>
INT DlgDirListComboBoxW(
HWND hDlg,
LPWSTR lpPathSpec,
INT nIDComboBox,
INT nIDStaticPath,
DLG_DIR_LIST_FILE_TYPE uFiletype
);[DllImport("USER32.dll", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
static extern int DlgDirListComboBoxW(
IntPtr hDlg, // HWND
[MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder lpPathSpec, // LPWSTR in/out
int nIDComboBox, // INT
int nIDStaticPath, // INT
uint uFiletype // DLG_DIR_LIST_FILE_TYPE
);<DllImport("USER32.dll", CharSet:=CharSet.Unicode, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function DlgDirListComboBoxW(
hDlg As IntPtr, ' HWND
<MarshalAs(UnmanagedType.LPWStr)> lpPathSpec As System.Text.StringBuilder, ' LPWSTR 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 : LPWSTR in/out
' nIDComboBox : INT
' nIDStaticPath : INT
' uFiletype : DLG_DIR_LIST_FILE_TYPE
Declare PtrSafe Function DlgDirListComboBoxW Lib "user32" ( _
ByVal hDlg As LongPtr, _
ByVal lpPathSpec As LongPtr, _
ByVal nIDComboBox As Long, _
ByVal nIDStaticPath As Long, _
ByVal uFiletype As Long) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DlgDirListComboBoxW = ctypes.windll.user32.DlgDirListComboBoxW
DlgDirListComboBoxW.restype = ctypes.c_int
DlgDirListComboBoxW.argtypes = [
wintypes.HANDLE, # hDlg : HWND
wintypes.LPWSTR, # lpPathSpec : LPWSTR 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')
DlgDirListComboBoxW = Fiddle::Function.new(
lib['DlgDirListComboBoxW'],
[
Fiddle::TYPE_VOIDP, # hDlg : HWND
Fiddle::TYPE_VOIDP, # lpPathSpec : LPWSTR in/out
Fiddle::TYPE_INT, # nIDComboBox : INT
Fiddle::TYPE_INT, # nIDStaticPath : INT
-Fiddle::TYPE_INT, # uFiletype : DLG_DIR_LIST_FILE_TYPE
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "user32")]
extern "system" {
fn DlgDirListComboBoxW(
hDlg: *mut core::ffi::c_void, // HWND
lpPathSpec: *mut u16, // LPWSTR 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.Unicode, SetLastError = true)]
public static extern int DlgDirListComboBoxW(IntPtr hDlg, [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder lpPathSpec, int nIDComboBox, int nIDStaticPath, uint uFiletype);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_DlgDirListComboBoxW' -Namespace Win32 -PassThru
# $api::DlgDirListComboBoxW(hDlg, lpPathSpec, nIDComboBox, nIDStaticPath, uFiletype)#uselib "USER32.dll"
#func global DlgDirListComboBoxW "DlgDirListComboBoxW" wptr, wptr, wptr, wptr, wptr
; DlgDirListComboBoxW hDlg, varptr(lpPathSpec), nIDComboBox, nIDStaticPath, uFiletype ; 戻り値は stat
; hDlg : HWND -> "wptr"
; lpPathSpec : LPWSTR in/out -> "wptr"
; nIDComboBox : INT -> "wptr"
; nIDStaticPath : INT -> "wptr"
; uFiletype : DLG_DIR_LIST_FILE_TYPE -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "USER32.dll" #cfunc global DlgDirListComboBoxW "DlgDirListComboBoxW" sptr, var, int, int, int ; res = DlgDirListComboBoxW(hDlg, lpPathSpec, nIDComboBox, nIDStaticPath, uFiletype) ; hDlg : HWND -> "sptr" ; lpPathSpec : LPWSTR in/out -> "var" ; nIDComboBox : INT -> "int" ; nIDStaticPath : INT -> "int" ; uFiletype : DLG_DIR_LIST_FILE_TYPE -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "USER32.dll" #cfunc global DlgDirListComboBoxW "DlgDirListComboBoxW" sptr, sptr, int, int, int ; res = DlgDirListComboBoxW(hDlg, varptr(lpPathSpec), nIDComboBox, nIDStaticPath, uFiletype) ; hDlg : HWND -> "sptr" ; lpPathSpec : LPWSTR in/out -> "sptr" ; nIDComboBox : INT -> "int" ; nIDStaticPath : INT -> "int" ; uFiletype : DLG_DIR_LIST_FILE_TYPE -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
; INT DlgDirListComboBoxW(HWND hDlg, LPWSTR lpPathSpec, INT nIDComboBox, INT nIDStaticPath, DLG_DIR_LIST_FILE_TYPE uFiletype) #uselib "USER32.dll" #cfunc global DlgDirListComboBoxW "DlgDirListComboBoxW" intptr, var, int, int, int ; res = DlgDirListComboBoxW(hDlg, lpPathSpec, nIDComboBox, nIDStaticPath, uFiletype) ; hDlg : HWND -> "intptr" ; lpPathSpec : LPWSTR in/out -> "var" ; nIDComboBox : INT -> "int" ; nIDStaticPath : INT -> "int" ; uFiletype : DLG_DIR_LIST_FILE_TYPE -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT DlgDirListComboBoxW(HWND hDlg, LPWSTR lpPathSpec, INT nIDComboBox, INT nIDStaticPath, DLG_DIR_LIST_FILE_TYPE uFiletype) #uselib "USER32.dll" #cfunc global DlgDirListComboBoxW "DlgDirListComboBoxW" intptr, intptr, int, int, int ; res = DlgDirListComboBoxW(hDlg, varptr(lpPathSpec), nIDComboBox, nIDStaticPath, uFiletype) ; hDlg : HWND -> "intptr" ; lpPathSpec : LPWSTR 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")
procDlgDirListComboBoxW = user32.NewProc("DlgDirListComboBoxW")
)
// hDlg (HWND), lpPathSpec (LPWSTR in/out), nIDComboBox (INT), nIDStaticPath (INT), uFiletype (DLG_DIR_LIST_FILE_TYPE)
r1, _, err := procDlgDirListComboBoxW.Call(
uintptr(hDlg),
uintptr(lpPathSpec),
uintptr(nIDComboBox),
uintptr(nIDStaticPath),
uintptr(uFiletype),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction DlgDirListComboBoxW(
hDlg: THandle; // HWND
lpPathSpec: PWideChar; // LPWSTR in/out
nIDComboBox: Integer; // INT
nIDStaticPath: Integer; // INT
uFiletype: DWORD // DLG_DIR_LIST_FILE_TYPE
): Integer; stdcall;
external 'USER32.dll' name 'DlgDirListComboBoxW';result := DllCall("USER32\DlgDirListComboBoxW"
, "Ptr", hDlg ; HWND
, "Ptr", lpPathSpec ; LPWSTR in/out
, "Int", nIDComboBox ; INT
, "Int", nIDStaticPath ; INT
, "UInt", uFiletype ; DLG_DIR_LIST_FILE_TYPE
, "Int") ; return: INT●DlgDirListComboBoxW(hDlg, lpPathSpec, nIDComboBox, nIDStaticPath, uFiletype) = DLL("USER32.dll", "int DlgDirListComboBoxW(void*, char*, int, int, dword)")
# 呼び出し: DlgDirListComboBoxW(hDlg, lpPathSpec, nIDComboBox, nIDStaticPath, uFiletype)
# hDlg : HWND -> "void*"
# lpPathSpec : LPWSTR 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)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。const std = @import("std");
extern "user32" fn DlgDirListComboBoxW(
hDlg: ?*anyopaque, // HWND
lpPathSpec: [*c]u16, // LPWSTR in/out
nIDComboBox: i32, // INT
nIDStaticPath: i32, // INT
uFiletype: u32 // DLG_DIR_LIST_FILE_TYPE
) callconv(std.os.windows.WINAPI) i32;
// Unicode(-W): UTF-16LE のヌル終端バッファ([*c]const u16)を渡す。proc DlgDirListComboBoxW(
hDlg: pointer, # HWND
lpPathSpec: ptr uint16, # LPWSTR in/out
nIDComboBox: int32, # INT
nIDStaticPath: int32, # INT
uFiletype: uint32 # DLG_DIR_LIST_FILE_TYPE
): int32 {.importc: "DlgDirListComboBoxW", stdcall, dynlib: "USER32.dll".}
# Unicode(-W): WideCString は newWideCString("...") で生成。pragma(lib, "user32");
extern(Windows)
int DlgDirListComboBoxW(
void* hDlg, // HWND
wchar* lpPathSpec, // LPWSTR in/out
int nIDComboBox, // INT
int nIDStaticPath, // INT
uint uFiletype // DLG_DIR_LIST_FILE_TYPE
);ccall((:DlgDirListComboBoxW, "USER32.dll"), stdcall, Int32,
(Ptr{Cvoid}, Ptr{UInt16}, Int32, Int32, UInt32),
hDlg, lpPathSpec, nIDComboBox, nIDStaticPath, uFiletype)
# hDlg : HWND -> Ptr{Cvoid}
# lpPathSpec : LPWSTR in/out -> Ptr{UInt16}
# nIDComboBox : INT -> Int32
# nIDStaticPath : INT -> Int32
# uFiletype : DLG_DIR_LIST_FILE_TYPE -> UInt32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
# Unicode(-W): Cwstring には transcode(UInt16, "...") 等で UTF-16 を渡す。local ffi = require("ffi")
ffi.cdef[[
int32_t DlgDirListComboBoxW(
void* hDlg,
uint16_t* lpPathSpec,
int32_t nIDComboBox,
int32_t nIDStaticPath,
uint32_t uFiletype);
]]
local user32 = ffi.load("user32")
-- user32.DlgDirListComboBoxW(hDlg, lpPathSpec, nIDComboBox, nIDStaticPath, uFiletype)
-- hDlg : HWND
-- lpPathSpec : LPWSTR in/out
-- nIDComboBox : INT
-- nIDStaticPath : INT
-- uFiletype : DLG_DIR_LIST_FILE_TYPE
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
-- Unicode(-W): uint16_t* には UTF-16LE のバッファ(ffi.new("uint16_t[?]", ...))を渡す。const koffi = require('koffi');
const lib = koffi.load('USER32.dll');
const DlgDirListComboBoxW = lib.func('__stdcall', 'DlgDirListComboBoxW', 'int32_t', ['void *', 'uint16_t *', 'int32_t', 'int32_t', 'uint32_t']);
// DlgDirListComboBoxW(hDlg, lpPathSpec, nIDComboBox, nIDStaticPath, uFiletype)
// hDlg : HWND -> 'void *'
// lpPathSpec : LPWSTR in/out -> 'uint16_t *'
// nIDComboBox : INT -> 'int32_t'
// nIDStaticPath : INT -> 'int32_t'
// uFiletype : DLG_DIR_LIST_FILE_TYPE -> 'uint32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("USER32.dll", {
DlgDirListComboBoxW: { parameters: ["pointer", "buffer", "i32", "i32", "u32"], result: "i32" },
});
// lib.symbols.DlgDirListComboBoxW(hDlg, lpPathSpec, nIDComboBox, nIDStaticPath, uFiletype)
// hDlg : HWND -> "pointer"
// lpPathSpec : LPWSTR in/out -> "buffer"
// nIDComboBox : INT -> "i32"
// nIDStaticPath : INT -> "i32"
// uFiletype : DLG_DIR_LIST_FILE_TYPE -> "u32"
// 文字列は "buffer"。Unicode(-W) は new TextEncoder() ではなく UTF-16LE のバイト列(末尾に \x00\x00)を Uint8Array で渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t DlgDirListComboBoxW(
void* hDlg,
uint16_t* lpPathSpec,
int32_t nIDComboBox,
int32_t nIDStaticPath,
uint32_t uFiletype);
C, "USER32.dll");
// $ffi->DlgDirListComboBoxW(hDlg, lpPathSpec, nIDComboBox, nIDStaticPath, uFiletype);
// hDlg : HWND
// lpPathSpec : LPWSTR in/out
// nIDComboBox : INT
// nIDStaticPath : INT
// uFiletype : DLG_DIR_LIST_FILE_TYPE
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface User32 extends StdCallLibrary {
User32 INSTANCE = Native.load("user32", User32.class, W32APIOptions.UNICODE_OPTIONS);
int DlgDirListComboBoxW(
Pointer hDlg, // HWND
char[] lpPathSpec, // LPWSTR in/out
int nIDComboBox, // INT
int nIDStaticPath, // INT
int uFiletype // DLG_DIR_LIST_FILE_TYPE
);
}
// Unicode(-W): WString(入力)/char[](出力)で UTF-16 をマーシャリング。@[Link("user32")]
lib LibUSER32
fun DlgDirListComboBoxW = DlgDirListComboBoxW(
hDlg : Void*, # HWND
lpPathSpec : UInt16*, # LPWSTR in/out
nIDComboBox : Int32, # INT
nIDStaticPath : Int32, # INT
uFiletype : UInt32 # DLG_DIR_LIST_FILE_TYPE
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef DlgDirListComboBoxWNative = Int32 Function(Pointer<Void>, Pointer<Utf16>, Int32, Int32, Uint32);
typedef DlgDirListComboBoxWDart = int Function(Pointer<Void>, Pointer<Utf16>, int, int, int);
final DlgDirListComboBoxW = DynamicLibrary.open('USER32.dll')
.lookupFunction<DlgDirListComboBoxWNative, DlgDirListComboBoxWDart>('DlgDirListComboBoxW');
// hDlg : HWND -> Pointer<Void>
// lpPathSpec : LPWSTR in/out -> Pointer<Utf16>
// nIDComboBox : INT -> Int32
// nIDStaticPath : INT -> Int32
// uFiletype : DLG_DIR_LIST_FILE_TYPE -> Uint32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function DlgDirListComboBoxW(
hDlg: THandle; // HWND
lpPathSpec: PWideChar; // LPWSTR in/out
nIDComboBox: Integer; // INT
nIDStaticPath: Integer; // INT
uFiletype: DWORD // DLG_DIR_LIST_FILE_TYPE
): Integer; stdcall;
external 'USER32.dll' name 'DlgDirListComboBoxW';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "DlgDirListComboBoxW"
c_DlgDirListComboBoxW :: Ptr () -> CWString -> Int32 -> Int32 -> Word32 -> IO Int32
-- hDlg : HWND -> Ptr ()
-- lpPathSpec : LPWSTR in/out -> CWString
-- nIDComboBox : INT -> Int32
-- nIDStaticPath : INT -> Int32
-- uFiletype : DLG_DIR_LIST_FILE_TYPE -> Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let dlgdirlistcomboboxw =
foreign "DlgDirListComboBoxW"
((ptr void) @-> (ptr uint16_t) @-> int32_t @-> int32_t @-> uint32_t @-> returning int32_t)
(* hDlg : HWND -> (ptr void) *)
(* lpPathSpec : LPWSTR in/out -> (ptr uint16_t) *)
(* nIDComboBox : INT -> int32_t *)
(* nIDStaticPath : INT -> int32_t *)
(* uFiletype : DLG_DIR_LIST_FILE_TYPE -> uint32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library user32 (t "USER32.dll"))
(cffi:use-foreign-library user32)
(cffi:defcfun ("DlgDirListComboBoxW" dlg-dir-list-combo-box-w :convention :stdcall) :int32
(h-dlg :pointer) ; HWND
(lp-path-spec :pointer) ; LPWSTR in/out
(n-idcombo-box :int32) ; INT
(n-idstatic-path :int32) ; INT
(u-filetype :uint32)) ; DLG_DIR_LIST_FILE_TYPE
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $DlgDirListComboBoxW = Win32::API::More->new('USER32',
'int DlgDirListComboBoxW(HANDLE hDlg, LPWSTR lpPathSpec, int nIDComboBox, int nIDStaticPath, DWORD uFiletype)');
# my $ret = $DlgDirListComboBoxW->Call($hDlg, $lpPathSpec, $nIDComboBox, $nIDStaticPath, $uFiletype);
# hDlg : HWND -> HANDLE
# lpPathSpec : LPWSTR in/out -> LPWSTR
# nIDComboBox : INT -> int
# nIDStaticPath : INT -> int
# uFiletype : DLG_DIR_LIST_FILE_TYPE -> DWORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# Unicode(-W): LPCWSTR/LPWSTR は Win32::API が UTF-16 変換を行う。関連項目
- f DlgDirListComboBoxA (ANSI版) — ディレクトリ内容をダイアログのコンボボックスに一覧表示する(ANSI版)。
- f DlgDirListW — ディレクトリ内容をダイアログのリストボックスに一覧表示する(Unicode版)。
- f DlgDirSelectComboBoxExW — コンボボックスで選択中のファイルやディレクトリ名を取得する(Unicode版)。