home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 10.ddi / PROGTALK.ZIP / DDECLIEN.H < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  1.7 KB  |  73 lines

  1. // ObjectWindows - (C) Copyright 1992 by Borland International
  2.  
  3. #ifndef __DDECLIEN_H
  4. #define __DDECLIEN_H
  5.  
  6. // OWL headers
  7. #include <owl.h>
  8. #include <dialog.h>
  9.  
  10. // Windows header
  11. #include <dde.h>
  12.  
  13. /*
  14.     TDDEClient is an interface object for a DDE client.
  15.     This was made a dialog window for the 'ProgTalk' demo because
  16.     that is    a convenient type for a window with several controls.
  17. */
  18.  
  19. class TDDEClient : public TDialog
  20. {
  21.     protected:
  22.         HWND ServerWindow;
  23.         WORD PendingMessage;
  24.  
  25.     public:
  26.  
  27.         /*
  28.             DDE window constructor.
  29.             Clear the DDE server window handle and the
  30.             pending DDE message ID.
  31.         */
  32.         TDDEClient( PTWindowsObject Parent, LPSTR AName )
  33.             : TDialog( Parent, AName ),
  34.             ServerWindow( 0 ),
  35.             PendingMessage( 0 )
  36.         {}
  37.  
  38.         /*
  39.             SetupWindow is called right after the DDE window
  40.             is created to initiate the DDE conversation.
  41.             This must be defined in a derived class in order
  42.             to correctly determine the DDE server and topic.
  43.         */
  44.         virtual void SetupWindow( void ) = 0;
  45.         /*
  46.             Return window class name. This name corresponds
  47.             to the class name specified for the DDE dialog
  48.             in the resource file.
  49.         */
  50.         virtual LPSTR GetClassName( void )
  51.         {
  52.             return "DDEClient";
  53.         }
  54.         void InitiateDDE( char* AppName, char* TopicName );
  55.         void TerminateDDE( void );
  56.  
  57.         virtual void WMDDEAck( TMessage& Msg )
  58.             = [ WM_FIRST + WM_DDE_ACK ];
  59.         virtual void WMDDETerminate( TMessage& Msg )
  60.             = [ WM_FIRST + WM_DDE_TERMINATE ];
  61.         virtual void WMClose( TMessage& Msg )
  62.             = [ WM_FIRST + WM_CLOSE ];
  63.         virtual void Cancel( TMessage& Msg )
  64.             = [ ID_FIRST + IDCANCEL ];
  65. };
  66.  
  67. inline void TDDEClient::Cancel( TMessage& Msg )
  68. {
  69.     TDDEClient::WMClose( Msg );
  70. }
  71.  
  72. #endif
  73.