急 ,VC问题,跪求高手解答

#include<Windows.h>#include<stdlib.h>#include<stdio.h>#defineIDL_SAMPLST101#defineFIL... #include <Windows.h>
#include <stdlib.h>
#include <stdio.h>
#define IDL_SAMPLST 101
#define FILE_LIST 0x4010
HWND hWndList;
HINSTANCE hInst;
WCHAR lpszListBoxClassName[] = L"ListBox";
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
int WINAPI WinMain(
__in HINSTANCE hInstance,
__in_opt HINSTANCE hPrevInstance,
__in_opt LPSTR lpCmdLine,
__in int nShowCmd )
{
HWND hwnd;
MSG Msg;
WNDCLASS wndclass;
WCHAR lpszClassName[] = L"窗口";
WCHAR lpszTitle[] = L"列表框示例程序";
wndclass.style = CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS;
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon(NULL,IDI_APPLICATION);
wndclass.hCursor = LoadCursor(NULL,IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wndclass.lpszClassName = (LPCTSTR)lpszClassName;
wndclass.lpszMenuName = NULL;
(LPCWSTR)lpszTitle;
if(!RegisterClass(&wndclass))
{
MessageBeep(0);
return false;
}
hInst = hInstance;
hwnd = CreateWindow(
lpszClassName,lpszTitle,
WS_OVERLAPPEDWINDOW|WS_HSCROLL|WS_VSCROLL,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,NULL,
hInstance,
NULL);
ShowWindow(hwnd,nShowCmd);
UpdateWindow(hwnd);
while(GetMessage(&Msg,NULL,0,0))
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
return Msg.wParam;
};
LRESULT CALLBACK WndProc(
HWND hwnd,
UINT message,
WPARAM wParam,
LPARAM lParam)
{ int nIndex;
switch (message)
{
case WM_CREATE:
hWndList = CreateWindow(lpszListBoxClassName,
NULL,
WS_CHILD|WS_VISIBLE|LBS_STANDARD|LBS_EXTENDEDSEL|LBS_MULTIPLESEL,
40,
80,
200,
100,
hwnd,
(HMENU)IDL_SAMPLST,
hInst,
NULL);
SendMessage(hWndList,LB_DIR,FILE_LIST,(LPARAM)"*.*");
break;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDL_SAMPLST:
if(HIWORD(wParam) == LBN_DBLCLK)
{

nIndex = SendMessage(hWndList,LB_GETCURSEL,0,0L);
SendMessage(hWndList,LB_DELETESTRING,nIndex,0L);

}
break;

}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd,message,wParam,lParam);
}
return(0);
}
为什么在列表框中只显示 驱动磁盘而不显示文件呢 ?我已经把FILE_LIST定义为0x4010了?怎么样才能显示文件呢 ?
展开
 我来答
cppcxz
2010-07-24 · 超过13用户采纳过TA的回答
知道答主
回答量:70
采纳率:0%
帮助的人:46.8万
展开全部

可以显示普通文件的,但是如果显示全部文件(readonly、system..),将FILE_LIST定义为0x4037

推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式