Getfolder()

HMG Samples and Enhancements

Moderator: Rathinagiri

dominique_devuyst
Posts: 11
Joined: Wed Dec 20, 2017 8:29 am
DBs Used: DBF
Location: Belgium
Has thanked: 10 times

Re: Getfolder()

Post by dominique_devuyst » Fri Apr 06, 2018 2:25 pm

Serge,

The folder path/name is ok (I have a multi language PC!).
I have tried C:\users\Administrateur\ and others folders not in Gebruiker : no problem.
Now, I see a padlock on Gebruiker.
However, I can read/write in the files and subfolders of the folder Gebruiker.
But the access seems blocked (only) for my application : strange!
I have tried to unlock Gebruiker in the properties, without result : it remains locked.
I continue to search for the why.

Dominique

edk
Posts: 342
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 96 times
Been thanked: 249 times

Post by edk » Fri Apr 06, 2018 4:16 pm

Start application in "Run as Administrator" mode and check if you have access to this folder.

dominique_devuyst
Posts: 11
Joined: Wed Dec 20, 2017 8:29 am
DBs Used: DBF
Location: Belgium
Has thanked: 10 times

Post by dominique_devuyst » Tue Apr 10, 2018 10:43 am

edk wrote:
Fri Apr 06, 2018 4:16 pm
Start application in "Run as Administrator" mode and check if you have access to this folder.
Hi edk,

I have already tried : it is the same.
He return 'My computer' and not the initpath.

Dominique

edk
Posts: 342
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 96 times
Been thanked: 249 times

Post by edk » Tue Apr 10, 2018 11:47 am

To which the user corresponds to the name "Gebruiker"? Will it be: Default, Default User, All Users, Public or is it called a local account in Windows?
What is the operating system?

dominique_devuyst
Posts: 11
Joined: Wed Dec 20, 2017 8:29 am
DBs Used: DBF
Location: Belgium
Has thanked: 10 times

Post by dominique_devuyst » Wed Apr 11, 2018 7:39 am

edk wrote:
Tue Apr 10, 2018 11:47 am
To which the user corresponds to the name "Gebruiker"? Will it be: Default, Default User, All Users, Public or is it called a local account in Windows?
What is the operating system?
Hi edk,

The OS is win7
The path is C:\Users\Gebruiker
The users are :
Capture_gebruiker1.JPG
Capture_gebruiker1.JPG (16.91 KiB) Viewed 730 times
Getfolder() returns the initpath for all folders (and subfolders) except for the folder Gebruiker and its contents.
I have tried to unlock Gebruiker (10 minuts!) but the padlock stay there.

Dominique

User avatar
serge_girard
Posts: 2106
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 434 times
Been thanked: 94 times
Contact:

Post by serge_girard » Wed Apr 11, 2018 10:23 am

Strange. It must be a naming problem. Edward, what do you think?

Serge

User avatar
esgici
Posts: 4454
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 336 times
Been thanked: 101 times
Contact:

Post by esgici » Wed Apr 11, 2018 11:41 am

serge_girard wrote:
Wed Apr 11, 2018 10:23 am
Strange ...
Could this "locked" symbol be pointing to something?
gebruiker.png
gebruiker.png (144.51 KiB) Viewed 715 times
Viva HMG :D
Viva INTERNATIONAL HMG :D

edk
Posts: 342
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 96 times
Been thanked: 249 times

Post by edk » Wed Apr 11, 2018 2:22 pm

It seems to me that, the padlock is not the reason for this behavior of the GetFolder function here.

The C:\USER\Gebruiker folder is in this case a profile folder.

In order for GetFolder to work with this folder, it should be possible to display the profile folder in the window.

Try this code, it works on Windows 10 for me:

Code: Select all

#include "hmg.ch"
#define plik_ini "demo.ini"

PROCEDURE MAIN()
Local cPath:=""

BEGIN INI FILE (plik_ini) 
	GET cPath SECTION "Main" ENTRY "Path" DEFAULT ""
END INI

IF EMPTY(cPath)
	BEGIN INI FILE (plik_ini)
		SET SECTION "Main" ENTRY "Path" TO "C:\"
	END INI
ENDIF


DEFINE WINDOW main_form ;
	AT 110,220 ;
	WIDTH 335 ;
	HEIGHT 260 ;
	TITLE 'Test';
	MAIN; 
	NOMAXIMIZE ;
	NOSIZE
	
	DEFINE MAIN MENU
		DEFINE POPUP "&File"
			MENUITEM "&Get Folder" ACTION GetFld()
			MENUITEM "E&xit" ACTION Main_form.Release
		END POPUP
	END MENU
	
END WINDOW 

Main_form.center
Main_form.activate

RETURN

//--------------------------------------------------------------------

FUNCTION GetFld()
Local cPath:="" 
BEGIN INI FILE (plik_ini) 
	GET cPath SECTION "Main" ENTRY "Path" DEFAULT ""
END INI

msgbox('InitPath for GetFolder(): ' + cPath )

cPath :=  GetFolder ( 'Get Folder' , cPath, , .T. /* [<lNewFolderButton>] */, .T. /* [<lIncludeFiles>] */, CSIDL_DRIVES + CSIDL_PROFILE /* [<nCSIDL_FolderType>] */ )

IF EMPTY(cPath)
	RETURN Nil
ENDIF

msgbox('Selected Path by GetFolder(): ' + cPath)

BEGIN INI FILE (plik_ini)
	SET SECTION "Main" ENTRY "Path" TO cPath
END INI

RETURN
*****************************************************************

User avatar
andyglezl
Posts: 983
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Has thanked: 20 times
Been thanked: 41 times
Contact:

Post by andyglezl » Wed Apr 11, 2018 2:30 pm

Tal vez en Seguridad...
En la carpeta oprimir Boton derecho / Propiedades / Seguridad
------------------------------------------------------------------------------
Maybe in Security ...
In the folder, click Right button / Properties / Security
seguridad.png
seguridad.png (192.39 KiB) Viewed 701 times
Andrés González López
Desde Guadalajara, Jalisco. México.

dominique_devuyst
Posts: 11
Joined: Wed Dec 20, 2017 8:29 am
DBs Used: DBF
Location: Belgium
Has thanked: 10 times

Post by dominique_devuyst » Wed Apr 11, 2018 5:43 pm

edk wrote:
Wed Apr 11, 2018 2:22 pm
It seems to me that, the padlock is not the reason for this behavior of the GetFolder function here.

The C:\USER\Gebruiker folder is in this case a profile folder.

In order for GetFolder to work with this folder, it should be possible to display the profile folder in the window.

Try this code, it works on Windows 10 for me ......

Thanks edk,

Getfolder() with your parameters work very fine!
Good to know!

Thank you very much for your help.

Dominique

Post Reply