| 1 | //
|
|---|
| 2 | // Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
|
|---|
| 3 | //
|
|---|
| 4 | // This file is part of the VNC system.
|
|---|
| 5 | //
|
|---|
| 6 | // The VNC system is free software; you can redistribute it and/or modify
|
|---|
| 7 | // it under the terms of the GNU General Public License as published by
|
|---|
| 8 | // the Free Software Foundation; either version 2 of the License, or
|
|---|
| 9 | // (at your option) any later version.
|
|---|
| 10 | //
|
|---|
| 11 | // This program is distributed in the hope that it will be useful,
|
|---|
| 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 14 | // GNU General Public License for more details.
|
|---|
| 15 | //
|
|---|
| 16 | // You should have received a copy of the GNU General Public License
|
|---|
| 17 | // along with this program; if not, write to the Free Software
|
|---|
| 18 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
|---|
| 19 | // USA.
|
|---|
| 20 | //
|
|---|
| 21 | // If the source code for the VNC system is not available from the place
|
|---|
| 22 | // whence you received this file, check http://www.uk.research.att.com/vnc or
|
|---|
| 23 | // contact the authors on vnc@uk.research.att.com for information on obtaining
|
|---|
| 24 | // it.
|
|---|
| 25 | //
|
|---|
| 26 | // AuthDialog.cpp: Implementation of the AuthDialog class.
|
|---|
| 27 | //
|
|---|
| 28 |
|
|---|
| 29 | #include "stdhdrs.h"
|
|---|
| 30 | #include "vncviewer.h"
|
|---|
| 31 | #include "AuthDialog.h"
|
|---|
| 32 | #include "Exception.h"
|
|---|
| 33 |
|
|---|
| 34 | //////////////////////////////////////////////////////////////////////
|
|---|
| 35 | // Construction/Destruction
|
|---|
| 36 | //////////////////////////////////////////////////////////////////////
|
|---|
| 37 |
|
|---|
| 38 | AuthDialog::AuthDialog()
|
|---|
| 39 | {
|
|---|
| 40 | m_passwd[0]=__T('\0');
|
|---|
| 41 | }
|
|---|
| 42 |
|
|---|
| 43 | AuthDialog::~AuthDialog()
|
|---|
| 44 | {
|
|---|
| 45 | }
|
|---|
| 46 |
|
|---|
| 47 | int AuthDialog::DoDialog()
|
|---|
| 48 | {
|
|---|
| 49 | return DialogBoxParam(pApp->m_instance,
|
|---|
| 50 | DIALOG_MAKEINTRESOURCE(IDD_AUTH_DIALOG),
|
|---|
| 51 | NULL,
|
|---|
| 52 | (DLGPROC) DlgProc,
|
|---|
| 53 | (LONG) this);
|
|---|
| 54 | }
|
|---|
| 55 |
|
|---|
| 56 | BOOL CALLBACK AuthDialog::DlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|---|
| 57 | {
|
|---|
| 58 | // This is a static method, so we don't know which instantiation we're
|
|---|
| 59 | // dealing with. But we can get a pseudo-this from the parameter to
|
|---|
| 60 | // WM_INITDIALOG, which we therafter store with the window and
|
|---|
| 61 | // retrieve as follows:
|
|---|
| 62 | AuthDialog *_this = (AuthDialog*) GetWindowLong(hwnd, GWL_USERDATA);
|
|---|
| 63 |
|
|---|
| 64 | switch (uMsg) {
|
|---|
| 65 | case WM_INITDIALOG:
|
|---|
| 66 | SetWindowLong(hwnd, GWL_USERDATA, lParam);
|
|---|
| 67 | _this = (AuthDialog*) lParam;
|
|---|
| 68 | CentreWindow(hwnd);
|
|---|
| 69 | return TRUE;
|
|---|
| 70 |
|
|---|
| 71 | case WM_COMMAND:
|
|---|
| 72 | switch (LOWORD(wParam)) {
|
|---|
| 73 | case IDOK: {
|
|---|
| 74 | UINT res = GetDlgItemText(hwnd, IDC_PASSWD_EDIT, _this->m_passwd, 256);
|
|---|
| 75 | EndDialog(hwnd, TRUE);
|
|---|
| 76 | return TRUE;
|
|---|
| 77 | }
|
|---|
| 78 | case IDCANCEL:
|
|---|
| 79 | EndDialog(hwnd, FALSE);
|
|---|
| 80 | return TRUE;
|
|---|
| 81 | }
|
|---|
| 82 | break;
|
|---|
| 83 |
|
|---|
| 84 | case WM_DESTROY:
|
|---|
| 85 | EndDialog(hwnd, FALSE);
|
|---|
| 86 | return TRUE;
|
|---|
| 87 | }
|
|---|
| 88 |
|
|---|
| 89 | return FALSE;
|
|---|
| 90 | }
|
|---|
| 91 |
|
|---|