Skip to main content
gamedev.net
🔒 Locked

LB_DIR

Started by maya18222 Oct 6, 2008 at 7:11 AM 1 replies 750+ views
Original Post
maya18222
maya18222
Can anyone see anything wrong with my could for the LB_DIR message? the
//DlgDirList(hwnd, buf, IDC_LIST_WEAPONS, 0, DIRATTR);
version works fine, but the
//SendDlgItemMessage(hwnd, IDC_LIST_WEAPONS, LB_DIR, (WPARAM)DIRATTR,  (LPARAM)buf);
doesnt do anything.

#define DIRATTR (DDL_READWRITE | DDL_READONLY | DDL_SYSTEM | DDL_DIRECTORY | DDL_ARCHIVE )

	TCHAR buf[MAX_PATH] =  TEXT ("c:\\");
	//DlgDirList(hwnd, buf, IDC_LIST_WEAPONS, 0, DIRATTR);
	SendDlgItemMessage(hwnd, IDC_LIST_WEAPONS, LB_DIR, (WPARAM)DIRATTR,  (LPARAM)buf);
	return 0;
implicit
implicit
Have you tried adding an asterisk to the path?
As far as I can tell LB_DIR can be used to add individual files and directories while DlgDirList replaces the list with the content of an entire directory. At least the part of DlgDirList's documentation which claims that paths without filenames have an implied wildcard is missing from LB_DIR.

By the way if a Win32 function fails for some mysterious reason then the first thing you should do is to check the return value. Zero indicates failure in this case. After that a watch for "@err,hr" will hopefully give you some idea of what's going on (in Visual Studio anyway), or you can look it up manually with GetLastError/FormatMessage.

Oh, and there's no need to force a size for initialized arrays, adding the MAX_PATH part merely wastes space.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.