Special folders

HMG Samples and Enhancements

Moderator: Rathinagiri

User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Special folders

Post by esgici »

Hi

A little work to obtain paths of special folders of windows.

Thanks to inspiration by friend Dave :)
Screen shoot<br />  of Special Folders test prg
Screen shoot
of Special Folders test prg
SpFldTst.jpg (115.6 KiB) Viewed 7365 times
SpFldTst.zip
Source files (.hbp, .prg) of Special Folders test prg
(2.95 KiB) Downloaded 446 times
Happy HMG'ing :D
Viva INTERNATIONAL HMG :D
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: Special folders

Post by srvet_claudio »

Hi Esgici.
Very good !!!
Regards,
Claudio.
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Re: Special folders

Post by Pablo César »

Very nice amigo Esgici ! Thank for your sharing !
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Special folders

Post by Rathinagiri »

Very useful Esgici.

I am very particular about the fonts folder for HMG_HPDF. Thanks.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
bpd2000
Posts: 1207
Joined: Sat Sep 10, 2011 4:07 am
Location: India

Re: Special folders

Post by bpd2000 »

Nice & thank you for sharing
BPD
Convert Dream into Reality through HMG
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Special folders

Post by esgici »

Hi

Found a more sophisticated and useful sample :

http://www.hexcentral.com/articles/foxpro-folders.htm

This is a foxpro function and seems could be adapt to Harbour.

But require a bit low-level expertness; because include something like shell32, ole32 :(

I hope that my amigo Pablo Cesar could achieve this task.

TIA
Viva INTERNATIONAL HMG :D
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: Special folders

Post by srvet_claudio »

Hi Esgici.
I hope you find it useful.

GET_FOLDER_LINK (id_SHGFP_TYPE, id_CSIDL) ---> Return cFolder

Best regards,
Claudio.

Code: Select all

// (c) Dr. Claudio Soto, 6 Mayo 2010

// see CSIDL_XXX description in ---> http://msdn.microsoft.com/en-us/library/windows/desktop/bb762494(v=vs.85).aspx
// define CSIDL_XXX in file     ---> shlobj.h

//**********
//  id_CSIDL
//**********
#define CSIDL_DESKTOP	0
#define CSIDL_INTERNET  1
#define CSIDL_PROGRAMS	2
#define CSIDL_CONTROLS	3
#define CSIDL_PRINTERS	4
#define CSIDL_PERSONAL	5
#define CSIDL_FAVORITES	6
#define CSIDL_STARTUP	7
#define CSIDL_RECENT	8
#define CSIDL_SENDTO	9
#define CSIDL_BITBUCKET	10
#define CSIDL_STARTMENU	11
#define CSIDL_MYMUSIC	13
#define CSIDL_MYVIDEO	14
#define CSIDL_DESKTOPDIRECTORY	16
#define CSIDL_DRIVES	17
#define CSIDL_NETWORK	18
#define CSIDL_NETHOOD	19
#define CSIDL_FONTS	20
#define CSIDL_TEMPLATES	21
#define CSIDL_COMMON_STARTMENU	22
#define CSIDL_COMMON_PROGRAMS	23
#define CSIDL_COMMON_STARTUP	24
#define CSIDL_COMMON_DESKTOPDIRECTORY	25
#define CSIDL_APPDATA   26
#define CSIDL_PRINTHOOD 27
#define CSIDL_LOCAL_APPDATA 28
#define CSIDL_ALTSTARTUP    29
#define CSIDL_COMMON_ALTSTARTUP	30
#define CSIDL_COMMON_FAVORITES	31
#define CSIDL_INTERNET_CACHE   32
#define CSIDL_COOKIES	33
#define CSIDL_HISTORY	34
#define CSIDL_COMMON_APPDATA	35
#define CSIDL_WINDOWS	36
#define CSIDL_SYSTEM	37
#define CSIDL_PROGRAM_FILES	38
#define CSIDL_MYPICTURES	39
#define CSIDL_PROFILE	40
#define CSIDL_SYSTEMX86	41
#define CSIDL_PROGRAM_FILESX86	42
#define CSIDL_PROGRAM_FILES_COMMON	43
#define CSIDL_PROGRAM_FILES_COMMONX86	44
#define CSIDL_COMMON_TEMPLATES	45
#define CSIDL_COMMON_DOCUMENTS	46
#define CSIDL_COMMON_ADMINTOOLS	47
#define CSIDL_ADMINTOOLS	48
#define CSIDL_CONNECTIONS	49
#define CSIDL_COMMON_MUSIC	53
#define CSIDL_COMMON_PICTURES	54
#define CSIDL_COMMON_VIDEO	55
#define CSIDL_RESOURCES	56
#define CSIDL_RESOURCES_LOCALIZED	57
#define CSIDL_COMMON_OEM_LINKS	58
#define CSIDL_CDBURN_AREA	59
#define CSIDL_COMPUTERSNEARME	61
#define CSIDL_FLAG_DONT_VERIFY	16384 // 0x4000
#define CSIDL_FLAG_CREATE	32768 // 0x8000
#define CSIDL_FLAG_MASK	65280 // 0xFF00


//***************
//  id_SHGFP_TYPE
//***************
#define SHGFP_TYPE_CURRENT  0   // Retrieve the folder's current path.
#define SHGFP_TYPE_DEFAULT  1   // Retrieve the folder's default path.
// If the folder has not been redirected, then SHGFP_TYPE_DEFAULT and SHGFP_TYPE_CURRENT retrieve the same path.

#include "hmg.ch"

Function Main
   MsgInfo (GET_FOLDER_LINK (SHGFP_TYPE_CURRENT, CSIDL_FAVORITES))
Return Nil



#pragma begindump

#include <windows.h>
#include <shlobj.h>

#include "hbapi.h"

//************************************************************************************************************
// GET_FOLDER_LINK (id_SHGFP_TYPE, id_CSIDL) ---> Return cFolder
//************************************************************************************************************
HB_FUNC (GET_FOLDER_LINK)
{   
    TCHAR pszPath [MAX_PATH];
    DWORD id_SHGFP_TYPE = (DWORD) hb_parnl (1);
    INT   id_CSIDL      = (INT)   hb_parnl (2);
    
    if(SUCCEEDED (SHGetFolderPath (NULL, id_CSIDL, NULL, id_SHGFP_TYPE, pszPath)))
        hb_retc (pszPath);
    else
        hb_retc ("ERROR: The folder does not exist");            
}

#pragma enddump
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: Special folders

Post by srvet_claudio »

Hi Esgici.
See application of the GET_FOLDER_LINK function in viewtopic.php?p=10535#p10535
Search recent open projects of the HMG.
Regards,
Claudio.
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Special folders

Post by esgici »

Hola Dr.

Thanks :)

You are a real treasure :arrow:

Are you sure that you are programming only as hobby ;)

Saludos and gracias cordiales :arrow:
Viva INTERNATIONAL HMG :D
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: Special folders

Post by srvet_claudio »

Hi Brother Esgici.
esgici wrote:You are a real treasure
Thank you very much, you are very kind.
esgici wrote:Are you sure that you are programming only as hobby
Yes, I'm only programming by hobby and fun (*)

(*) I did my first virus (memory-resident Trojan in C) when he was 16 years old, all I did was clear the screen every 5 seconds and display the message: "This computer is with diarrhea", was very fun to see the cries of my friends... "teacher, teacher, teacher, the computer is with diarrhea?" and the professor responded: "computer with diarrhea? you all are crazy !!!"

Best Regards,
Claudio.
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
Post Reply