1 //---------------------------------------------------------------------------
4 //---------------------------------------------------------------------------
5 #include "ReceiverImpl.h"
6 #include "BroadcasterC.h"
10 #include <Controls.hpp>
11 #include <StdCtrls.hpp>
14 //---------------------------------------------------------------------------
15 // Message used to notify window of incoming data
16 #define WM_MESSAGE_RECEIVED (WM_APP + 0x123)
17 //---------------------------------------------------------------------------
18 class TChatClientWindow
: public TForm
20 __published
: // IDE-managed Components
23 TOpenDialog
*OpenDialog
;
24 void __fastcall
FormClose (TObject
*Sender
, TCloseAction
&Action
);
25 void __fastcall
InputMemoKeyPress (TObject
*Sender
, char &Key
);
28 // Function to read the server ior from a file.
29 void __fastcall
ReadIOR (String filename
);
31 // IOR of the obj ref of the server.
34 // The filename that stores the ior of the server
35 String ior_file_name_
;
37 // Nickname of the user chatting.
40 // We run the orb's main loop in a separate thread.
41 std::unique_ptr
<TORBThread
> orb_thread_
;
43 // Our orb. Order is important! The orb must have a longer lifetime than
44 // any of the servants or stub vars/ptrs. Therefore we declare the orb var
45 // first. There is probably a better way to do this, maybe by using a
50 Broadcaster_var server_
;
52 // The receiver object.
53 TReceiverImplementation receiver_i_
;
55 // Pointer to the receiver object registered with the ORB.
56 Receiver_var receiver_var_
;
58 public: // User declarations
59 __fastcall
TChatClientWindow (TComponent
* Owner
);
61 protected: // Message handlers
62 void __fastcall
WMMessageReceived (TMessage
& Message
);
64 VCL_MESSAGE_HANDLER (WM_MESSAGE_RECEIVED
, TMessage
, WMMessageReceived
)
65 END_MESSAGE_MAP (TForm
)
67 //---------------------------------------------------------------------------
68 extern PACKAGE TChatClientWindow
*ChatClientWindow
;
69 //---------------------------------------------------------------------------