Getfolder()

HMG Samples and Enhancements

Moderator: Rathinagiri

dominique_devuyst
Posts: 22
Joined: Wed Dec 20, 2017 8:29 am
DBs Used: DBF
Location: Belgium

Re: Getfolder()

Post by dominique_devuyst »

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: 909
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: Getfolder()

Post by edk »

Start application in "Run as Administrator" mode and check if you have access to this folder.
dominique_devuyst
Posts: 22
Joined: Wed Dec 20, 2017 8:29 am
DBs Used: DBF
Location: Belgium

Re: Getfolder()

Post by dominique_devuyst »

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: 909
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: Getfolder()

Post by edk »

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: 22
Joined: Wed Dec 20, 2017 8:29 am
DBs Used: DBF
Location: Belgium

Re: Getfolder()

Post by dominique_devuyst »

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 5934 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: 3161
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Getfolder()

Post by serge_girard »

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

Serge
There's nothing you can do that can't be done...
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Getfolder()

Post by esgici »

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 5919 times
Viva HMG :D
Viva INTERNATIONAL HMG :D
edk
Posts: 909
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: Getfolder()

Post by edk »

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: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: Getfolder()

Post by andyglezl »

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 5905 times
Andrés González López
Desde Guadalajara, Jalisco. México.
dominique_devuyst
Posts: 22
Joined: Wed Dec 20, 2017 8:29 am
DBs Used: DBF
Location: Belgium

Re: Getfolder()

Post by dominique_devuyst »

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