12-14-2005 02:12 PM
12-15-2005 02:32 PM
12-16-2005 02:46 AM
12-16-2005 08:22 AM
12-16-2005 02:16 PM
Thanks, Sarah, for putting it in as a suggestion for future versions.
I agree that the strategy of getting them to go to a file could work, but in my case I need them to specify a directory (often empty) in advance.
--Ian
12-16-2005 03:00 PM
Chaos,
Thanks -- this is looking good. I've been able to see the pop-up your DLL generates, and it looks much more intuitive.
Three questions for you, and/or some LabWindows specialists:
- Would you be able to have it include a "default directory" argument? (Please!)
- Any advice on dealing with the "CStr" type? (What include file defines it?) I'm struggling to convert it to a simple C "char *" array.
- Should (how could) I directly use the Windows SDK function "BrowseForFolder"?
Many thanks!
--Ian
12-16-2005 04:28 PM - edited 12-16-2005 04:28 PM
Message Edited by Chaos on 12-16-2005 04:29 PM
12-19-2005 01:10 PM
Thanks again, Chaos. I'm able to get at that result now.
For those who are interested, I've attached a small project that implements your DLL. (I'm not going to pursue the SDK approach.)
Cheers,
Ian
02-07-2022 04:03 PM
I know this is a very old discussion, but would you happen to have a 64-bit version of this DLL? I'm looking to upgrade an old LabWindows-based test tool and the software engineer who wrote it apparently used your 32-bit version.
02-08-2022 08:46 AM - edited 02-08-2022 08:55 AM
Something along these lines:
#include <ShlObj.h>
/* Parameters
* hwndOwner owner window for dialog
* title title text to display above the tree view control
* initialPath path to start at
* selectedPath receives the user selected path, must be at least MAX_PATH long
* Returns
* TRUE on success, FALSE on error
*/
BOOL BrowseForFolder(HWND hWndOwner, char *title, char *initialPath, char *selectedPath)
{
BOOL retval = FALSE;
LPITEMIDLIST lpItem;
BROWSEINFOA bInfo;
bInfo.hwndOwner = hWndOwner;
bInfo.pidlRoot = NULL;
bInfo.pszDisplayName = initialPath;
bInfo.lpszTitle = title;
bInfo.ulFlags = 0; // maybe use BIF_NEWDIALOGSTYLE;
bInfo.lpfn = NULL;
bInfo.lParam = 0;
bInfo.iImage = -1;
lpItem = SHBrowseForFolderA(&bInfo);
if (lpItem != NULL)
{
if (SHGetPathFromIDListA(lpItem, selectedPath))
retval = TRUE;
CoTaskMemFree(lpItem);
}
return retval;
}