Backup & Restore Dbf Files

You can share your experience with HMG. Share with some screenshots/project details so that others will also be benefited.

Moderator: Rathinagiri

User avatar
sudip
Posts: 1446
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India
Has thanked: 5 times
Been thanked: 1 time

Re: Backup & Restore Dbf Files

Post by sudip » Sun May 17, 2009 4:38 am

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
With best regards,
Sudip

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

Post by esgici » Mon Mar 26, 2012 10:49 am

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
Viva INTERNATIONAL HMG :D

User avatar
gfilatov
Posts: 658
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Has thanked: 24 times
Been thanked: 227 times
Contact:

Post by gfilatov » Mon Mar 26, 2012 1:21 pm

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:
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein

User avatar
Rathinagiri
Posts: 5263
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 169 times
Been thanked: 172 times
Contact:

Post by Rathinagiri » Mon Mar 26, 2012 1:42 pm

Wow. Thanks Grigory.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

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

Post by esgici » Mon Mar 26, 2012 3:08 pm

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
Viva INTERNATIONAL HMG :D

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

Post by esgici » Tue Mar 27, 2012 4:28 pm

Hi

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

Any idea :?:

Regards

--

Esgici
Viva INTERNATIONAL HMG :D

User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 100 times
Been thanked: 182 times

Post by Pablo César » Tue Mar 27, 2012 6:05 pm

Our COMPRESS command doesn't include files smaller than (approximately 1 KB)
Ohhh no ! Really ?
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

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

Post by esgici » Tue Mar 27, 2012 6:26 pm

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
Viva INTERNATIONAL HMG :D

User avatar
mol
Posts: 3227
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 224 times
Been thanked: 126 times
Contact:

Post by mol » Wed Mar 28, 2012 5:17 am

I was testing archive created in my program an it seems everything is OK with small files and compress...

Regards, Marek

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

Post by esgici » Wed Mar 28, 2012 11:40 am

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 283 times
Viva INTERNATIONAL HMG :D

Post Reply