怎么用SendMessage 和LB_DIR结合使用,在listbox中列出路径下的文件
如何用SendMessage 和LB_DIR结合使用,在listbox中列出路径下的文件
这个原来是 <Windows 程序设计> 的例子.
书上用在WM_CREATE时候,SendMessage (hwndList, LB_DIR, DIRATTR, (LPARAM) TEXT ( "*.* ")) ; 结果是出来当前目录下的文件夹,我想让listbox 列出指定路径下的文件,要如何写这个代码??请问大家,小弟属菜鸟一类,望指教!
我用TCHAR szt[] =TEXT ( "F:\\工作备份\\界面代码收集\\消息 "); SendMessage(hwndList,LB_DIR,DIRATTR,(LPARAM)szt);
可是listbox中只是加入了 "消息 ",却没有列出 "消息 "文件夹下的文件来,为什么啊????
------解决方案--------------------
wParam
Specifies the attributes of the files or directories to be added to the list box. This parameter can be one or more of the following values.
DDL_ARCHIVE
Includes archived files.
DDL_DIRECTORY
Includes subdirectories. Subdirectory names are enclosed in square brackets ([ ]).
DDL_DRIVES
All mapped drives are added to the list. Drives are listed in the form [-x-], where x is the drive letter.
DDL_EXCLUSIVE
Includes only files with the specified attributes. By default, read-write files are listed even if DDL_READWRITE is not specified.
DDL_HIDDEN
Includes hidden files.
DDL_READONLY
Includes read-only files.
DDL_READWRITE
Includes read-write files with no additional attributes. This is the default setting.
DDL_SYSTEM
Includes system files.
这个原来是 <Windows 程序设计> 的例子.
书上用在WM_CREATE时候,SendMessage (hwndList, LB_DIR, DIRATTR, (LPARAM) TEXT ( "*.* ")) ; 结果是出来当前目录下的文件夹,我想让listbox 列出指定路径下的文件,要如何写这个代码??请问大家,小弟属菜鸟一类,望指教!
我用TCHAR szt[] =TEXT ( "F:\\工作备份\\界面代码收集\\消息 "); SendMessage(hwndList,LB_DIR,DIRATTR,(LPARAM)szt);
可是listbox中只是加入了 "消息 ",却没有列出 "消息 "文件夹下的文件来,为什么啊????
------解决方案--------------------
wParam
Specifies the attributes of the files or directories to be added to the list box. This parameter can be one or more of the following values.
DDL_ARCHIVE
Includes archived files.
DDL_DIRECTORY
Includes subdirectories. Subdirectory names are enclosed in square brackets ([ ]).
DDL_DRIVES
All mapped drives are added to the list. Drives are listed in the form [-x-], where x is the drive letter.
DDL_EXCLUSIVE
Includes only files with the specified attributes. By default, read-write files are listed even if DDL_READWRITE is not specified.
DDL_HIDDEN
Includes hidden files.
DDL_READONLY
Includes read-only files.
DDL_READWRITE
Includes read-write files with no additional attributes. This is the default setting.
DDL_SYSTEM
Includes system files.