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

  1. /* 
  2.     DDEINFO.CPP -
  3.     
  4.     This file:
  5.  
  6.         Defines specific DDE server information.  Only ACAD and
  7.         Microsoft EXCEL server info is defined.
  8.  
  9.  
  10.     (C) Copyright 1988-1994 by Autodesk, Inc.
  11.  
  12.     This program is copyrighted by Autodesk, Inc. and is  licensed
  13.     to you under the following conditions.  You may not distribute
  14.     or  publish the source code of this program in any form.   You
  15.     may  incorporate this code in object form in derivative  works
  16.     provided  such  derivative  works  are  (i.) are  designed and
  17.     intended  to  work  solely  with  Autodesk, Inc. products, and
  18.     (ii.)  contain  Autodesk's  copyright  notice  "(C)  Copyright
  19.     1988-1994 by Autodesk, Inc."
  20.  
  21.     AUTODESK  PROVIDES THIS PROGRAM "AS IS" AND WITH  ALL  FAULTS.
  22.     AUTODESK  SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF  MER-
  23.     CHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK,  INC.
  24.     DOES  NOT  WARRANT THAT THE OPERATION OF THE PROGRAM  WILL  BE
  25.     UNINTERRUPTED OR ERROR FREE.
  26.  
  27. */
  28. #include "ddeinc.h"
  29.  
  30. /******************************************************************************
  31. *                                                                             *
  32. *                    SERVER_INFO member functions                             *
  33. *                                                                             *
  34. ******************************************************************************/
  35. //-----------------------------------------------------------------------------
  36. void SERVER_INFO::Start()
  37. {
  38.     if ( exepath[0]== '\0' || WinExec( exepath.CString(), SW_SHOW ) <= 32 )
  39.     {
  40.         ::MessageBox( GetFocus()
  41.                     , "Can not start the DDE server"
  42.                     , "Warning", MB_OK );
  43.     }
  44. }
  45.  
  46. //-----------------------------------------------------------------------------
  47. BOOL SERVER_INFO::Ready( HSZ service, HSZ topic, HSZ item )
  48. {
  49.     return TRUE;
  50. }
  51.  
  52. //-----------------------------------------------------------------------------
  53. SERVER_INFO::SERVER_INFO( char *regkey, DDESERVER id )
  54. {
  55.     server_id = id;
  56.  
  57.     exepath = "";
  58.     
  59.     HKEY    hKey;
  60.     LONG    cb = 256;
  61.  
  62.     if ( RegOpenKey( HKEY_CLASSES_ROOT
  63.         , regkey
  64.         , &hKey ) == ERROR_SUCCESS )
  65.     {
  66.         if ( RegQueryValue( hKey, "server", ( char * )exepath.CString(), &cb ) != ERROR_SUCCESS )
  67.         {
  68.             exepath = "";
  69.         }
  70.         RegCloseKey( hKey );
  71.     }
  72. }
  73.  
  74. //-----------------------------------------------------------------------------
  75. SERVER_INFO::~SERVER_INFO()
  76. {
  77. }
  78.  
  79. /******************************************************************************
  80. *                                                                             *
  81. *                   SS_SERVER_INFO member functions                           *
  82. *                                                                             *
  83. ******************************************************************************/
  84. //-----------------------------------------------------------------------------
  85. SS_SERVER_INFO::SS_SERVER_INFO( char *regkey 
  86.                                 , int _max_row
  87.                                 , int _max_col 
  88.                                 , int _cur_row
  89.                                 , int _cur_col 
  90.                                 , char *_ssrow
  91.                                 , char *_sscol
  92.                                 , char *_ssdelim
  93.                                 , char *_row_sep
  94.                                 , char *_col_sep 
  95.                                 , DDESERVER id ) : SERVER_INFO( regkey, id )
  96. {
  97.     cur_row = _cur_row;
  98.     cur_col = _cur_col;
  99.     max_row = _max_row;
  100.     max_col = _max_col;
  101.  
  102.     ssrow =  _ssrow;
  103.     sscol = _sscol;
  104.     ssdelim = _ssdelim;
  105.     row_seperator = _row_sep;
  106.     col_seperator = _col_sep;
  107.     seperators = row_seperator + col_seperator;
  108. }
  109.  
  110. //-----------------------------------------------------------------------------
  111. SS_SERVER_INFO::~SS_SERVER_INFO()
  112. {
  113. }
  114.  
  115. //-----------------------------------------------------------------------------
  116. SS_SERVER_INFO::SS_SERVER_INFO( const SS_SERVER_INFO& src )
  117.                                 : SERVER_INFO( src )
  118. {
  119.     cur_row = src.cur_row;
  120.     cur_col = src.cur_col;
  121.     max_row = src.max_row;
  122.     max_col = src.max_col;
  123.  
  124.     ssrow = src.ssrow;
  125.     sscol = src.sscol;
  126.     ssdelim = src.ssdelim;
  127.     row_seperator = src.row_seperator;
  128.     col_seperator = src.col_seperator;
  129.     seperators = row_seperator + col_seperator;
  130. }
  131.  
  132. //-----------------------------------------------------------------------------
  133. SS_SERVER_INFO& SS_SERVER_INFO::operator=( const SS_SERVER_INFO& src )
  134. {
  135.     SERVER_INFO::operator=( src );
  136.     cur_row = src.cur_row;
  137.     cur_col = src.cur_col;
  138.     max_row = src.max_row;
  139.     max_col = src.max_col;
  140.  
  141.     ssrow = src.ssrow;
  142.     sscol = src.sscol;
  143.     ssdelim = src.ssdelim;
  144.  
  145.     row_seperator = src.row_seperator;
  146.     col_seperator = src.col_seperator;
  147.     seperators = row_seperator + col_seperator;
  148.  
  149.     return *this;
  150. }                            
  151.