home *** CD-ROM | disk | FTP | other *** search
/ Windows 95 v2.4 Fix / W95-v2.4fix.iso / ACADWIN / ADS / CPP / MFCADS / MFCLIST / ENTLIST.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1995-02-08  |  3.6 KB  |  110 lines

  1. /* 
  2.     ENTLIST.CPP -
  3.     
  4.     This file:
  5.  
  6.         A simple ADS MFC list box demo application.  List out
  7.         all entities in the current drawing, given the entity is
  8.         supported entities in ADS_ENT class, in a list box.  Double 
  9.         clicking in the list box brings up a detail information 
  10.         about the selected entity.
  11.  
  12.         From ACAD command prompt:
  13.  
  14.         ( xload "MFCLIST" ) to start the application.
  15.  
  16.     (C) Copyright 1988-1994 by Autodesk, Inc.
  17.  
  18.     This program is copyrighted by Autodesk, Inc. and is  licensed
  19.     to you under the following conditions.  You may not distribute
  20.     or  publish the source code of this program in any form.   You
  21.     may  incorporate this code in object form in derivative  works
  22.     provided  such  derivative  works  are  (i.) are  designed and
  23.     intended  to  work  solely  with  Autodesk, Inc. products, and
  24.     (ii.)  contain  Autodesk's  copyright  notice  "(C)  Copyright
  25.     1988-1994 by Autodesk, Inc."
  26.  
  27.     AUTODESK  PROVIDES THIS PROGRAM "AS IS" AND WITH  ALL  FAULTS.
  28.     AUTODESK  SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF  MER-
  29.     CHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK,  INC.
  30.     DOES  NOT  WARRANT THAT THE OPERATION OF THE PROGRAM  WILL  BE
  31.     UNINTERRUPTED OR ERROR FREE.
  32.  
  33. */
  34. #include "mfclist.h"
  35.  
  36. //-----------------------------------------------------------------------------
  37. struct MYADS_APP : ADS_APP
  38. {
  39.     BOOL            InitInstance();
  40.     void            GetSelectedEntity( struct resbuf *rb );
  41. };
  42.  
  43. //-----------------------------------------------------------------------------
  44. static char temp_buf[ 256 ];
  45.  
  46. //-----------------------------------------------------------------------------
  47. extern "C" void GetSelectedEntity( struct resbuf* rb)
  48. {
  49.     ( ( MYADS_APP *)main_app )->GetSelectedEntity( rb );
  50. }
  51.  
  52. //-----------------------------------------------------------------------------
  53. extern "C" void test( struct resbuf* )
  54. {
  55.     wsprintf( temp_buf, "HELLO\n" );
  56.     ads_printf( temp_buf );
  57. }
  58.  
  59. //-----------------------------------------------------------------------------
  60. ADS_FUNC_INFO       app_funs[] = 
  61. {
  62. /*                                                                    */
  63. /*      Function                       Type            Name           */
  64. /*                                                                    */
  65.     ADS_FUNC_INFO( ADS_FUNC( test ),   ADS_VOID_FUNC,  "c:test", "Use Test\n")
  66.   , ADS_FUNC_INFO( ADS_FUNC( GetSelectedEntity), ADS_VOID_FUNC, "C:GetSelectedEntity", NULL )
  67. };
  68.  
  69. //-----------------------------------------------------------------------------
  70. // This function has to be called from AutoCAD!!!
  71. //
  72. void MYADS_APP::GetSelectedEntity( struct resbuf * )
  73. {
  74.     ads_name        temp_ent_name;
  75.  
  76.     ( ( CWINDOW* )m_pMainWnd )->GetEntityName( &temp_ent_name );
  77.  
  78.     CENTITYDIALOG *ent_dialog = MakeEntityDialog( temp_ent_name );
  79.     if ( ent_dialog )
  80.     {
  81.         ent_dialog->DoModal();
  82.         DeleteEntityDialog( ent_dialog );
  83.     }
  84. }
  85.  
  86. //-----------------------------------------------------------------------------
  87. BOOL    MYADS_APP::InitInstance()
  88. {
  89.     if ( ADS_APP::InitInstance() != TRUE )
  90.     {
  91.         return FALSE;
  92.     }
  93.  
  94.     for ( int i = 0; i < ARRAY_SIZE( app_funs ); i++ )
  95.     {
  96.         if ( InsertExternFunc( app_funs[i] ) == -1 )
  97.         {
  98.             return FALSE;
  99.         }
  100.     }
  101.     
  102.     m_pMainWnd = new CWINDOW();
  103.     m_pMainWnd->ShowWindow(m_nCmdShow);
  104.     m_pMainWnd->UpdateWindow();
  105.     return TRUE;
  106. }
  107.  
  108. //-----------------------------------------------------------------------------
  109. MYADS_APP   myads_app;
  110.