--
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: https://groups.google.com/group/harbour-users
---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/harbour-users/9f3b63f1-272c-46a2-a052-df03917a82bbn%40googlegroups.com.
Hi Antonio.
If you need to do it in non-gui (text mode) Harbour program, as I know there is no Harbour command to select folder. There is no command which will prepare list of all folders on some drive (C: or D: or ...) and give it to user to select desired one.
You must use DIRECTORY() function, see link https://harbour.github.io/doc/clc53.html#directory .
Question is what folders (and subfolders) user can see and select. If users can see folders and its subfolders, you must write some recursive function with DIRECTORY() function to get list of all folders and put them in some array. Then use that array of directories and make some browse function with which user will select desired folder. In browse function you can use Harbour ACHOICE() function or TBROWSE object.
I used DIRECTORY() only to list and select files from predefined folder, not to select folders.
You can ask ChatGPT how to get list of folders and how to browse array and will get usefull starting point.
Regards,
Simo.A C function:
#pragma BEGINDUMP
#include "hbapi.h"
#include <windows.h>
#include "hbapiitm.h"
#include <shlobj.h>
#include "hbvm.h"
#include "hbstack.h"
//SYNTAX:
SHBrowseForFolder([<hWnd>],[<cTitle>],<nFlags>,[<nFolderType>])
HB_FUNC( SHBROWSEFORFOLDER )
{
HWND hwnd = ISNIL (1) ? GetActiveWindow() : (HWND)
hb_parnl(1);
BROWSEINFO BrowseInfo;
char *lpBuffer = (char*) hb_xgrab( MAX_PATH + 1 );
LPITEMIDLIST pidlBrowse;
SHGetSpecialFolderLocation(hwnd, ISNIL(4) ? CSIDL_DRIVES :
hb_parni(4), &pidlBrowse) ;
BrowseInfo.hwndOwner = hwnd;
BrowseInfo.pidlRoot = pidlBrowse;
BrowseInfo.pszDisplayName = lpBuffer;
BrowseInfo.lpszTitle = ISNIL (2) ? "Select a Folder" :
hb_parcx(2);
BrowseInfo.ulFlags = hb_parni(3);
BrowseInfo.lpfn = NULL;
BrowseInfo.lParam = 1;
BrowseInfo.iImage = 0;
pidlBrowse = SHBrowseForFolder(&BrowseInfo);
if ( pidlBrowse )
{
SHGetPathFromIDList(pidlBrowse,lpBuffer);
hb_retc( lpBuffer );
}
else
{
hb_retc( "" );
}
hb_xfree( lpBuffer);
}
#pragma ENDDUMP
Use:
cNewdir=shbrowseforfolder(,"Choose directory")
HTH
Dan
--
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: https://groups.google.com/group/harbour-users
---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/harbour-users/a0bf8561-0583-4a02-8123-28621b775679n%40googlegroups.com.