⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vncviewerapp.cpp

📁 teamviewer source code vc++
💻 CPP
字号:
//  Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
//
//  This file is part of TeamViewer.
//
//  TeamViewer is free software; you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation; either version 2 of the License, or
//  (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
//  USA.
//
//  If the source code for TeamViewer is not available from the place 
//  whence you received this file, check http://www.teamviewer.com
//  for information on obtaining it.

#include "stdhdrs.h"
#include "VNCviewerApp.h"
extern char sz_B1[64];
extern char sz_B2[64];
extern char sz_B3[64];

// For WinCE Palm, you might want to use this for debugging, since it
// seems impossible to give the command some arguments.
// #define PALM_LOG 1

VNCviewerApp *pApp;

VNCviewerApp::VNCviewerApp(HINSTANCE hInstance, LPTSTR szCmdLine) {
	pApp = this;
	m_instance = hAppInstance;

	// Read the command line
	m_options.SetFromCommandLine(szCmdLine);
	
	// Clear connection list
	for (int i = 0; i < MAX_CONNECTIONS; i++)
		m_clilist[i] = NULL;
}


// The list of clients should fill up from the start and have NULLs
// afterwards.  If the first entry is a NULL, the list is empty.

void VNCviewerApp::RegisterConnection(ClientConnection *pConn) {
	omni_mutex_lock l(m_clilistMutex);
	int i;
	for (i = 0; i < MAX_CONNECTIONS; i++) {
		if (m_clilist[i] == NULL) {
			m_clilist[i] = pConn;
			vnclog.Print(4,VNCLOG(_T("Registered connection with app")));
			return;
		}
	}
	// If we've got here, something is wrong.
	vnclog.Print(-1, VNCLOG(_T("Client list overflow!")));
	MessageBox(NULL, sz_B2, sz_B3,
		MB_OK | MB_ICONSTOP);
	PostQuitMessage(1);

}

void VNCviewerApp::DeregisterConnection(ClientConnection *pConn) {
	omni_mutex_lock l(m_clilistMutex);
	int i;
	for (i = 0; i < MAX_CONNECTIONS; i++) {
		if (m_clilist[i] == pConn) {
			// shuffle everything above downwards
			for (int j = i; m_clilist[j] &&	j < MAX_CONNECTIONS-1 ; j++)
				m_clilist[j] = m_clilist[j+1];
			m_clilist[MAX_CONNECTIONS-1] = NULL;
			vnclog.Print(4,VNCLOG(_T("Deregistered connection from app")));

			// No clients left? then we should finish, unless we're in
			// listening mode.
			// Don't close in TeamViewer
			//if ((m_clilist[0] == NULL) && (!pApp->m_options.m_listening))
			//	PostQuitMessage(0);

			return;
		}
	}
	// If we've got here, something is wrong.
	vnclog.Print(-1, VNCLOG(_T("Client not found for deregistering!")));
	PostQuitMessage(1);
}

int VNCviewerApp::ConnectionCount()
{
	omni_mutex_lock l(m_clilistMutex);
	int count = 0;
	for(int i=0; i<MAX_CONNECTIONS; i++)
	{
		if(m_clilist[i] != NULL)
			++count;
	}
	return count;
}

void VNCviewerApp::AbortConnections()
{
	for(int i=0; i<MAX_CONNECTIONS; i++)
	{
		if(m_clilist[i] != NULL)
			m_clilist[i]->AbortConnection();
	}
}

// ----------------------------------------------


VNCviewerApp::~VNCviewerApp() {
		
	
	// Clean up winsock
	// WSACleanup();  TR@2004: is done when MainApp quits
	
	vnclog.Print(2, VNCLOG(_T("VNC viewer closing down")));

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -