CnC_Remastered_Collection

Command and Conquer: Red Alert
Log | Files | Refs | README | LICENSE

DDE.H (7419B)


      1 //
      2 // Copyright 2020 Electronic Arts Inc.
      3 //
      4 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free 
      5 // software: you can redistribute it and/or modify it under the terms of 
      6 // the GNU General Public License as published by the Free Software Foundation, 
      7 // either version 3 of the License, or (at your option) any later version.
      8 
      9 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed 
     10 // in the hope that it will be useful, but with permitted additional restrictions 
     11 // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT 
     12 // distributed with this program. You should have received a copy of the 
     13 // GNU General Public License along with permitted additional restrictions 
     14 // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
     15 
     16 /***************************************************************************
     17  **   C O N F I D E N T I A L --- W E S T W O O D    S T U D I O S        **
     18  ***************************************************************************
     19  *                                                                         *
     20  *                 Project Name : Dynamic Data Encapsulation					*
     21  *                                                                         *
     22  *                    File Name : DDE.H												*
     23  *                                                                         *
     24  *                   Programmer : Steve Wetherill									*
     25  *                                                                         *
     26  *                   Start Date : June 1, 1996		                        *
     27  *                                                                         *
     28  *                  Last Update : June 8, 1996   [SW]                 		*
     29  *                                                                         *
     30  *-------------------------------------------------------------------------*
     31  *                                                                         *
     32  * This is the DDE (Instance_Class) which provides a simple CLIENT/SERVER	*
     33  * DDE model for data transactions between Windows applications.				*
     34  * This is a fairly naieve implementation allowing only one client/server	*
     35  * per Instance_Class object. 															*
     36  *																									*
     37  * Typical uses for this class are:														*
     38  *																									*
     39  * i. Robust verification of whether an application is running					*
     40  * ii. Data transfer between applications												*
     41  *																									*
     42  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
     43 
     44 /*
     45 ***************************** Class defines *****************************
     46 */
     47 #ifndef 	__DDE_H
     48 #define	__DDE_H
     49 
     50 //#if (0)
     51 
     52 #define	DDE_ADVISE_CONNECT		-1		// advisory "client has connected"
     53 #define	DDE_ADVISE_DISCONNECT	-2		// advisory "client has disconnected"
     54 
     55 /*
     56 ***************************** Class Declaration *****************************
     57 */
     58 
     59 class	Instance_Class {
     60 
     61 	/*
     62 	---------------------------- Public Interface ----------------------------
     63 	*/
     64 	public:
     65 
     66 		/*.....................................................................
     67 		Constructor:
     68 		- takes null terminated ASCII strings names for client and server
     69 		.....................................................................*/
     70 
     71 		Instance_Class(		// constructor
     72 			LPSTR,				// null terminated local sever name string
     73 			LPSTR					// null terminated remote server name string
     74 			);
     75 
     76 		/*.....................................................................
     77 		Destructor:
     78 		.....................................................................*/
     79 		~Instance_Class(void);	// the destructor
     80 
     81 		/*.....................................................................
     82 		Send data routine:
     83 		- sends an unsolicited packet of data to the remote server
     84 		.....................................................................*/
     85 		BOOL	Poke_Server( LPBYTE, DWORD);
     86 
     87 		/*.....................................................................
     88 		Send data routine:
     89 		- sets up DNS for the server and registers a user callback to handle
     90 		  incoming data
     91 		.....................................................................*/
     92 		BOOL	Register_Server( BOOL (CALLBACK *)(LPBYTE, long));
     93 
     94 //typedef void    (CALLBACK *LPDXUTCALLBACKFRAMEMOVE)( double fTime, float fElapsedTime, void* pUserContext );
     95 
     96 
     97 		/*.....................................................................
     98 		Does a trial connect to the remote server.
     99 		- used to determine whether server is alive or not (and thus running)
    100 		.....................................................................*/
    101 		BOOL	Test_Server_Running( HSZ );
    102 
    103 		/*.....................................................................
    104 		Enables user callback (disabled by default)
    105 		.....................................................................*/
    106 		BOOL	Enable_Callback( BOOL );		// enable or disable callback
    107 
    108 		/*.....................................................................
    109 		Open a connection for sending data to remote server
    110 		.....................................................................*/
    111 		BOOL	Open_Poke_Connection( HSZ );
    112 
    113 		/*.....................................................................
    114 		Close connection with remote server
    115 		.....................................................................*/
    116 		BOOL	Close_Poke_Connection( void );
    117 
    118 		//
    119 		// static members
    120 		//
    121 
    122 		/*.....................................................................
    123 		User callback - called upon receipt of incoming data (static member!)
    124 		.....................................................................*/
    125 		static BOOL (CALLBACK  *callback) (
    126 
    127 			LPBYTE pointer,		// pointer to received data
    128 			long length				// if >0 length of received data
    129 										// if <0
    130 										//	-1 == client connect detected
    131 										// -2 == client disconnect detected
    132 			);
    133 
    134 		/*.....................................................................
    135 		DDE callback, called when DDEML has an event for us
    136 		.....................................................................*/
    137 		static HDDEDATA CALLBACK dde_callback(
    138 
    139 			UINT  uType,		// transaction type
    140 			UINT  uFmt,			// clipboard data format
    141 			HCONV  hconv,		// handle of the conversation
    142 			HSZ  hsz1,			// handle of a string
    143 			HSZ  hsz2,			// handle of a string
    144 			HDDEDATA  hdata,	// handle of a global memory object
    145 			DWORD  dwData1,	// transaction-specific data
    146 			DWORD  dwData2 	// transaction-specific data
    147 			);
    148 		HANDLE	instance;	// this application's instance
    149 		HWND		hwnd;			// valid window handle
    150 
    151 		/*.....................................................................
    152 		member variables
    153 		.....................................................................*/
    154 
    155 		static DWORD id_inst;			// instance identifier set by DdeInitialize
    156 		static BOOL	process_pokes;		// controls response to pokes
    157 		static char ascii_name[32];	// name of server
    158 
    159 		//
    160 		// non-static member variables
    161 		//
    162 
    163 		HSZ remote_name; 		// string handle for remote server name
    164 		HSZ local_name; 		// string handle for local server name
    165 		HSZ system_topic;		// string handle for the "system" topic
    166 		HSZ poke_topic;		// string handle for poking data to server topic
    167 		HSZ poke_item;			// string handle for poking data to server item
    168 
    169 		HCONV conv_handle;   // conversation handle
    170 		BOOL	dde_error;		// error flag
    171 
    172 };
    173 #endif
    174 
    175 //#endif
    176