Page 3 of 5

Re: Backup & Restore Dbf Files

Posted: Sun May 17, 2009 4:38 am
by sudip
Hi Esgici,

I tested your Backup & Restore software.

Thank you very much. :)

I learned GetFolder(), PutFile(), GetCurrentFolder() functions from you.

I didn't know it :)

IMHO, this software has 2 problems.

1. When compressing it stores full path of files, which sometimes give problem, eg., restoring into another drive.
2. Progressbar for uncompress doesn't work properly.

UncompressFiles ( cZipFile, {|cFile,nPos| main.pbRestore.value := nPos ,;
main.StatusBar.Item(1) := cFile }, .T. )

In above function nPos doesn't return the percentage completed. (Please test with fewer number of large dbf files)

Regarding using low level C staff, I am fully agree with you. If I knew those functions, I didn't use C functions :)

With best regards.

Sudip

Re: Backup & Restore Dbf Files

Posted: Mon Mar 26, 2012 10:49 am
by esgici
Hi all

Does anyone know a way to adding a second parameter for <Initial Folder> to GetFolder() function ?

Or a new function with this ability ?

Regards / saludos.

--

Esgici

Re: Backup & Restore Dbf Files

Posted: Mon Mar 26, 2012 1:21 pm
by gfilatov
esgici wrote:Hi all

Does anyone know a way to adding a second parameter for <Initial Folder> to GetFolder() function ?

Or a new function with this ability ?
Hi Esgici,

Please try the following simple sample: :arrow:

Code: Select all

#include "minigui.ch"

Procedure Main()

	DEFINE WINDOW Form_1 ;
		AT 0,0 WIDTH 200 HEIGHT 150 ;
		MAIN ;
		TITLE "GetFolder Sample" ;
		NOSIZE

		DEFINE MAIN MENU
			DEFINE POPUP 'Test'
				MENUITEM 'BrowseForFolder()' ACTION MsgInfo(BrowseForFolder('Select Folder', GetCurrentFolder()),"Result")
				MENUITEM 'Exit' ACTION Form_1.Release
			END POPUP
		END MENU


	END WINDOW

	Form_1.Center
	Form_1.Activate

Return

*-----------------------------------------------------------------------------*
Static Function BrowseForFolder( cTitle, cInitPath )
*-----------------------------------------------------------------------------*
Return HMG_BrowseForFolder( NIL, cTitle, NIL, NIL, cInitPath )

*------------------------------------------------------------------------------*
* Low Level C Routines
*------------------------------------------------------------------------------*

#pragma BEGINDUMP

#include <windows.h>
#include "hbapi.h"

#include <commdlg.h>
#include <shlobj.h>
#include <commctrl.h>

int CALLBACK BrowseCallbackProc ( HWND hWnd, UINT uMsg, LPARAM lParam, LPARAM lpData )
{
   TCHAR szPath[ MAX_PATH ];

   switch( uMsg )
   {
   case BFFM_INITIALIZED:  if( lpData )
         SendMessage( hWnd, BFFM_SETSELECTION, TRUE, lpData );
      break;
   case BFFM_SELCHANGED:   SHGetPathFromIDList( ( LPITEMIDLIST ) lParam, szPath ); SendMessage( hWnd, BFFM_SETSTATUSTEXT, 0, ( LPARAM ) szPath );
   }

   return 0;
}

HB_FUNC( HMG_BROWSEFORFOLDER )  // Syntax: HMG_BROWSEFORFOLDER([<hWnd>],[<cTitle>],[<nFlags>],[<nFolderType>],[<cInitPath>])
{
   HWND hWnd = HB_ISNIL( 1 ) ? GetActiveWindow() : ( HWND ) hb_parnl( 1 );
   BROWSEINFO BrowseInfo;
   char *lpBuffer = ( char * ) hb_xgrab( MAX_PATH + 1 );
   LPITEMIDLIST pidlBrowse;

   SHGetSpecialFolderLocation( hWnd, HB_ISNIL(4) ? CSIDL_DRIVES : hb_parni(4), &pidlBrowse );

   BrowseInfo.hwndOwner = hWnd;
   BrowseInfo.pidlRoot = pidlBrowse;
   BrowseInfo.pszDisplayName = lpBuffer;
   BrowseInfo.lpszTitle = HB_ISNIL( 2 ) ? "Select a Folder" : hb_parc( 2 );
   BrowseInfo.ulFlags = HB_ISCHAR( 5 ) ? BIF_STATUSTEXT : hb_parni( 3 );
   BrowseInfo.lpfn = HB_ISCHAR( 5 ) ? BrowseCallbackProc : NULL;
   BrowseInfo.lParam = HB_ISCHAR( 5 ) ? ( LPARAM ) ( char * ) hb_parc( 5 ) : 0;
   BrowseInfo.iImage = 0;

   pidlBrowse = SHBrowseForFolder( &BrowseInfo );

   if( pidlBrowse )
   {
      SHGetPathFromIDList( pidlBrowse, lpBuffer );
      hb_retc( lpBuffer );
   }
   else
      hb_retc( "" );

   hb_xfree( lpBuffer );
}

#pragma ENDDUMP
Hope that useful :idea:

Re: Backup & Restore Dbf Files

Posted: Mon Mar 26, 2012 1:42 pm
by Rathinagiri
Wow. Thanks Grigory.

Re: Backup & Restore Dbf Files

Posted: Mon Mar 26, 2012 3:08 pm
by esgici
gfilatov wrote: Please try the following simple sample: :arrow:
Thanks Grigory :)

Itsn't so simple ( at least for me ) ;)

You are a real guru of our community;

Fortunately, you are here :D

Best regards

--

Esgici

Re: Backup & Restore Dbf Files

Posted: Tue Mar 27, 2012 4:28 pm
by esgici
Hi

Our COMPRESS command doesn't include files smaller than (approximately 1 KB) :(

Any idea :?:

Regards

--

Esgici

Re: Backup & Restore Dbf Files

Posted: Tue Mar 27, 2012 6:05 pm
by Pablo César
Our COMPRESS command doesn't include files smaller than (approximately 1 KB)
Ohhh no ! Really ?

Re: Backup & Restore Dbf Files

Posted: Tue Mar 27, 2012 6:26 pm
by esgici
Hola Pablo
Pablo César wrote:Ohhh no ! Really ?
Thanks to your interest amigo :)

Now, I'm not sure that problem is that "not including" :(

I'm compressing a folder with 55 files, and when open the .zip file by windows explorer, seen only 13 files. Seem missing files are small in size.

And with another folder, .zip file is empty ( including big files too) :o

I don't know may be any difference in implementation of .zip files, between our lib and Windows or other software.

Saludos

--

Esgici

Re: Backup & Restore Dbf Files

Posted: Wed Mar 28, 2012 5:17 am
by mol
I was testing archive created in my program an it seems everything is OK with small files and compress...

Regards, Marek

Re: Backup & Restore Dbf Files

Posted: Wed Mar 28, 2012 11:40 am
by esgici
Hi Mol

Thanks to your interest :)

My problem isn't about file sizes, previous post about that is wrong, sorry :(

Now, problem is compressing files in other than current folder.

Could you test please attached sample ( sligthly modified your program ) by changing source folder ?

Moreover, our COMPRESS doesn't support :
  • - Option for storing or omitting path info of compressed files
    - Option for including or omitting sub-folders
    - Compressing level
    - Password protection
Thanks in advances.
BactRestMol.zip
Backup program by Mol
(3.96 KiB) Downloaded 344 times