138 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			138 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
//
 | 
						|
// ARCHPM.CPP
 | 
						|
//
 | 
						|
//  Source file for ArchiveLib 2.0
 | 
						|
//
 | 
						|
//  Copyright (c) Greenleaf Software, Inc. 1994-1996
 | 
						|
//  All Rights Reserved
 | 
						|
//
 | 
						|
// CONTENTS
 | 
						|
//
 | 
						|
//  ALArchive::FillListBox()
 | 
						|
//  ALArchiveFillListBox()
 | 
						|
//
 | 
						|
// REVISION HISTORY
 | 
						|
//
 | 
						|
//   February 14, 1996  2.0A : New release
 | 
						|
 | 
						|
#include "arclib.h"
 | 
						|
#if !defined( AL_IBM )
 | 
						|
#pragma hdrstop
 | 
						|
#endif
 | 
						|
 | 
						|
#include "memstore.h"
 | 
						|
 | 
						|
//
 | 
						|
// NAME
 | 
						|
//
 | 
						|
//  ALArchive::FillListBox()
 | 
						|
//
 | 
						|
// PLATFORMS/ENVIRONMENTS
 | 
						|
//
 | 
						|
//  PM
 | 
						|
//  C++  C
 | 
						|
//
 | 
						|
// SHORT DESCRIPTION
 | 
						|
//
 | 
						|
//  Fill a PM list box with the file names from an archive.
 | 
						|
//
 | 
						|
// C++ SYNOPSIS
 | 
						|
//
 | 
						|
//  #include "arclib.h"
 | 
						|
//
 | 
						|
//  int ALArchive::FillListBox( HWND hDlg,
 | 
						|
//                              int list_box_id = -1 );
 | 
						|
//
 | 
						|
// C SYNOPSIS
 | 
						|
//
 | 
						|
//  #include "arclib.h"
 | 
						|
//
 | 
						|
//  int ALArchiveFillListBox( hALArchive this_object,
 | 
						|
//                            HWND hWnd,
 | 
						|
//                            int list_box_id );
 | 
						|
//
 | 
						|
// VB SYNOPSIS
 | 
						|
//
 | 
						|
//  None, no version of VB for PM at this time.
 | 
						|
//
 | 
						|
// DELPHI SYNOPSIS
 | 
						|
//
 | 
						|
//  None, no version of Delphi for PM at this time.
 | 
						|
//
 | 
						|
// ARGUMENTS
 | 
						|
//
 | 
						|
//  this_object  :  A reference or pointer to the ALArchive object that
 | 
						|
//                  is going to be read in.  Note that the C++ member fn
 | 
						|
//                  version of this call doesn't have an explicit argument
 | 
						|
//                  here, since it has access to 'this' implicitly.
 | 
						|
//
 | 
						|
//  hWnd       :    This argument can represent one of two things.
 | 
						|
//                  If the value of list_box_id is set to -1, it means that
 | 
						|
//                  hWnd refers to an actual list box itself.  If the value
 | 
						|
//                  of list_box_id is not -1, it means that hWnd referes
 | 
						|
//                  to a dialog box, and list_box_id refers the id of a
 | 
						|
//                  list box control within that dialog box.
 | 
						|
//
 | 
						|
//  list_box_id:    See the description of hWnd for a full detail of what
 | 
						|
//                  this argument does.
 | 
						|
//
 | 
						|
// DESCRIPTION
 | 
						|
//
 | 
						|
//  This is a quicky useful function to read the names of all the
 | 
						|
//  storage objects out of this, then stuff them all into a list
 | 
						|
//  box.
 | 
						|
//
 | 
						|
// RETURNS
 | 
						|
//
 | 
						|
//  The count of objects in the archive, or an error status < 0.
 | 
						|
//
 | 
						|
// EXAMPLE
 | 
						|
//
 | 
						|
// SEE ALSO
 | 
						|
//
 | 
						|
// REVISION HISTORY
 | 
						|
//
 | 
						|
//   February 14, 1996  2.0A : New release
 | 
						|
//
 | 
						|
 | 
						|
int AL_PROTO
 | 
						|
ALArchive::FillListBox( HWND hDlg,  /* Tag public function */
 | 
						|
                        int list_box_id /* = -1 */ )
 | 
						|
{
 | 
						|
    ALMemory m;
 | 
						|
    ALToolKit k( m );
 | 
						|
    ALEntryList list( 0, k );
 | 
						|
    HWND hwnd;
 | 
						|
 | 
						|
    ReadDirectory( list );
 | 
						|
    if ( list_box_id != -1 )
 | 
						|
        hwnd = WinWindowFromID( hDlg, list_box_id );
 | 
						|
    else
 | 
						|
        hwnd = hDlg;
 | 
						|
    int count;
 | 
						|
    if ( ( count = list.FillListBox( hwnd ) ) == 0 ) {
 | 
						|
        if ( mStatus < 0 ) {
 | 
						|
            WinSendMsg( hwnd , LM_DELETEALL, 0, 0 );
 | 
						|
            WinSendMsg( hwnd,
 | 
						|
                        LM_INSERTITEM,
 | 
						|
                        0,
 | 
						|
                        MPFROMP( (PSZ) "Error!" ) );
 | 
						|
        }
 | 
						|
    }
 | 
						|
    return count;
 | 
						|
}
 | 
						|
 | 
						|
#if !defined( AL_NO_C )
 | 
						|
 | 
						|
extern "C" AL_LINKAGE int AL_FUNCTION
 | 
						|
ALArchiveFillListBox( hALArchive this_object,  /* Tag public function */
 | 
						|
                      HWND hWnd,
 | 
						|
                      int list_box_id )
 | 
						|
{
 | 
						|
    AL_ASSERT_OBJECT( this_object, ALArchive, "ALArchiveFillListBox" );
 | 
						|
    return ( (ALArchive *) this_object )->FillListBox( hWnd, list_box_id );
 | 
						|
}
 | 
						|
 | 
						|
#endif
 | 
						|
 |