144 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			144 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
| //
 | |
| // CXL_EDIT.CPP
 | |
| //
 | |
| //  Source file for ArchiveLib 2.0
 | |
| //
 | |
| //  Copyright (c) Greenleaf Software, Inc. 1994-1996
 | |
| //  All Rights Reserved
 | |
| //
 | |
| // CONTENTS
 | |
| //
 | |
| //  EditDisplay()
 | |
| //
 | |
| // DESCRIPTION
 | |
| //
 | |
| //  C and VB programmers cant use the iostreams operators, so this
 | |
| //  function is used to give them the same capabilities.
 | |
| //
 | |
| // REVISION HISTORY
 | |
| //
 | |
| //  May 21, 1994  1.0A  : First release
 | |
| //
 | |
| //   February 14, 1996  2.0A : New release
 | |
| //
 | |
| 
 | |
| #include "arclib.h"
 | |
| #if !defined( AL_IBM )
 | |
| #pragma hdrstop
 | |
| #endif
 | |
| 
 | |
| #include <stdarg.h>
 | |
| #include <stdio.h>
 | |
| 
 | |
| //
 | |
| // NAME
 | |
| //
 | |
| //  EditDisplay()
 | |
| //
 | |
| // PLATFORMS/ENVIRONMENTS
 | |
| //
 | |
| //  Windows
 | |
| //  C++  C
 | |
| //
 | |
| // SHORT DESCRIPTION
 | |
| //
 | |
| //  printf() to an edit/text control.
 | |
| //
 | |
| // C++ SYNOPSIS
 | |
| //
 | |
| //  #include "arclib.h"
 | |
| //  #include "winutil.h"
 | |
| //
 | |
| //  extern "C" void EditDisplay( HWND hDlg,
 | |
| //                               int control_id,
 | |
| //                               char *fmt,
 | |
| //                               ... );
 | |
| //
 | |
| // C SYNOPSIS
 | |
| //
 | |
| //  #include "arclib.h"
 | |
| //  #include "winutil.h"
 | |
| //
 | |
| //  void EditDisplay( HWND hDlg,
 | |
| //                    int control_id,
 | |
| //                    char *fmt,
 | |
| //                    ... );
 | |
| //
 | |
| // VB SYNOPSIS
 | |
| //
 | |
| //  None, this function just isn't going to work with Vb.
 | |
| //
 | |
| // DELPHI SYNOPSIS
 | |
| //
 | |
| //  None, not a good fit for Delphi.
 | |
| //
 | |
| // ARGUMENTS
 | |
| //
 | |
| //  hDlg   :  This argument is a window handle.  If the next parameter,
 | |
| //            control_id, is set to -1, it means this is the handle of
 | |
| //            the window that will have some new text written to it.
 | |
| //            If control_id is some other value, it means this is the
 | |
| //            handle of a dialog box, and control_id refers to an edit
 | |
| //            control within the dialog box.  That edit control is the
 | |
| //            destination for the text output.
 | |
| //
 | |
| //  control_id :  The id of the multiline edit control in a dialog box.  If
 | |
| //                set to -1, it means the edit control is not in a dialog box,
 | |
| //                and the hDlg parameter is the handle of the edit control.
 | |
| //
 | |
| //  fmt    :  The format parameter to be used in wsprintf.
 | |
| //
 | |
| //  ...    :  Any additional arguments that are going to be used by
 | |
| //            vsprintf().
 | |
| //
 | |
| // DESCRIPTION
 | |
| //
 | |
| //  This little function lets you use a printf() style command to print
 | |
| //  data to a multiline edit control.  The internal buffer is only 128
 | |
| //  bytes, so please be careful.
 | |
| //
 | |
| // RETURNS
 | |
| //
 | |
| //  Nothing.
 | |
| //
 | |
| // EXAMPLE
 | |
| //
 | |
| // SEE ALSO
 | |
| //
 | |
| // REVISION HISTORY
 | |
| //
 | |
| //   February 14, 1996  2.0A : New release
 | |
| //
 | |
| 
 | |
| extern "C" AL_LINKAGE void AL_CFUNCTION
 | |
| EditDisplay( HWND hDlg,  /* Tag public function */
 | |
|              int id,
 | |
|              char AL_DLL_FAR *fmt,
 | |
|              ... )
 | |
| {
 | |
|     char buffer[ 128 ];
 | |
|     HWND window;
 | |
|     va_list args;
 | |
| 
 | |
|     va_start( args, fmt );
 | |
| //
 | |
| // Watcom does this differently than everyone else.  It isn't really
 | |
| // part of the ANSI spec, so we can't complain.
 | |
| //
 | |
| #if !defined( AL_WATCOM ) 
 | |
|     wvsprintf( buffer, fmt, args );
 | |
| #else
 | |
|     wvsprintf( buffer, fmt, *args );
 | |
| #endif
 | |
|     va_end( args );
 | |
|     if ( id == -1 )
 | |
|         window = hDlg;
 | |
|     else
 | |
|         window = GetDlgItem( hDlg, (short int) id );
 | |
|     SendMessage( window,
 | |
|                  EM_REPLACESEL,
 | |
|                  0,
 | |
|                  (LPARAM) ( (LPSTR) buffer ) );
 | |
| }
 | |
| 
 |