Constantin Kaplinsky | 729598c | 2006-05-25 05:12:25 +0000 | [diff] [blame] | 1 | /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. |
| 2 | * |
| 3 | * This is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License as published by |
| 5 | * the Free Software Foundation; either version 2 of the License, or |
| 6 | * (at your option) any later version. |
| 7 | * |
| 8 | * This software is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with this software; if not, write to the Free Software |
| 15 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
| 16 | * USA. |
| 17 | */ |
| 18 | |
| 19 | // -=- ConnectingDialog.h |
| 20 | |
| 21 | // ConnectingDialog instances are used to display a status dialog while a |
| 22 | // connection attempt is in progress. The connection attempt is performed |
| 23 | // in a background thread by the ConnectingDialog, to allow the status dialog |
| 24 | // to remain interactive. If the dialog is cancelled then it will close and |
| 25 | // the connection dialog will eventually tidy itself up. |
| 26 | |
| 27 | #ifndef __RFB_WIN32_CONNECTING_DLG_H__ |
| 28 | #define __RFB_WIN32_CONNECTING_DLG_H__ |
| 29 | |
| 30 | #include <windows.h> |
| 31 | #include <network/Socket.h> |
| 32 | #include <rfb/util.h> |
| 33 | #include <rfb_win32/Handle.h> |
| 34 | |
| 35 | namespace rfb { |
| 36 | |
| 37 | namespace win32 { |
| 38 | |
| 39 | class ConnectingDialog { |
| 40 | public: |
| 41 | ConnectingDialog(); |
| 42 | |
| 43 | // connect |
| 44 | // Show a Connecting dialog and attempt to connect to the specified host |
| 45 | // in the background. |
| 46 | // If the connection succeeds then the Socket is returned. |
| 47 | // If an error occurs, an Exception is thrown. |
| 48 | // If the dialog is cancelled then null is returned. |
| 49 | network::Socket* connect(const char* hostAndPort); |
| 50 | protected: |
| 51 | HWND dialog; |
| 52 | network::Socket* newSocket; |
| 53 | CharArray errMsg; |
| 54 | Handle readyEvent; |
| 55 | int dialogId; |
| 56 | |
| 57 | class Thread; |
| 58 | friend class Thread; |
| 59 | }; |
| 60 | |
| 61 | }; |
| 62 | |
| 63 | }; |
| 64 | |
| 65 | #endif |