Page 1 of 1
Any function to create nested folders at one go?
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Mon Aug 22, 2011 2:44 am
by hua
Hi guys,
To clarify, if I need a folder called c:\my program\data\backup, the function will auto create My Program, Data and Backup as necessary.
TIA
Re: Any function to create nested folders at one go?
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Mon Aug 22, 2011 11:48 am
by nageswaragunupudi
- Code: Select all Expand view
#pragma BEGINDUMP
#include <shlobj.h>
#include <hbapi.h>
HB_FUNC (SHCREATEDIRECTORY)
{
hb_retni( SHCreateDirectoryEx( NULL, hb_parc( 1 ), NULL ) );
}
#pragma ENDDUMP
In you application, use the function ShCreateDirectory( <cFullPath> )
Return value indicates success.
Link shell32.lib with application.
You may even declare this as DLL function.
Re: Any function to create nested folders at one go?
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Mon Aug 22, 2011 12:04 pm
by hua
Thanks Rao
![Smile :)](./images/smilies/icon_smile.gif)
Re: Any function to create nested folders at one go?
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Mon Aug 22, 2011 6:32 pm
by FranciscoA
Hi, Rao. Can you post a sample, please?
Re: Any function to create nested folders at one go?
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Mon Aug 22, 2011 9:03 pm
by FranciscoA
Rao, Please ignore the previous post. I already did it.
Thanks.
Re: Any function to create nested folders at one go?
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Mon Aug 22, 2011 9:26 pm
by Otto
Would you be so kind to post the answer.
Best regards,
Otto
Re: Any function to create nested folders at one go?
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Tue Aug 23, 2011 4:30 am
by FranciscoA
As Rao said, we must link shell32.lib with our aplication. (Shell32.Lib is in the Borland directory)
//------------------
Function Prueba()
local cDirDest := "C:\FRANCISCO\DOCUMENTOS\DIVERSOS\"
ShCreateDirectory( cDirDest )
Return Nil
#pragma BEGINDUMP
#include <shlobj.h>
#include <hbapi.h>
HB_FUNC (SHCREATEDIRECTORY)
{
hb_retni( SHCreateDirectoryEx( NULL, hb_parc( 1 ), NULL ) );
}
#pragma ENDDUMP
Saludos.