Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Remote Control PCs

, 20 Sep 2013 GPL3
Two projects that work together to remote control PCs across a LAN.
// Remote Desktop System - remote controlling of multiple PC's
// Copyright (C) 2000-2009 GravyLabs LLC

// This program 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; version 2 of the License.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// 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.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#pragma once

#include <intrin.h>
#include <memory>
#include "zlib.h"

#if defined(_DEBUG)
#if !defined(X64)
#pragma comment(lib,"..\\Zlib32d.lib")
#pragma comment(lib,"..\\Zlib64d.lib")
#if !defined(X64)
#pragma comment(lib,"..\\Zlib32.lib")
#pragma comment(lib,"..\\Zlib64.lib")

#define MAXTHREADS 64
#define WM_ENDTHREAD (WM_APP + 100)
#define WM_IMAGEREFRESH (WM_APP + 102)
#define WM_IMAGESEND (WM_APP + 104)
#define WM_IMAGERENEW (WM_APP + 105)


void DebugMsg(const TCHAR * pwszFormat,...);
void DebugLastError();

// Debugging timer used for detecting the duration of an operation
class CDuration
   const TCHAR * p;
   clock_t start;
   clock_t finish;
   CDuration(const TCHAR * sz) : p(sz),start(clock()),finish(start) {};
      finish = clock();
      double duration = (double)(finish - start) / CLOCKS_PER_SEC;
      DebugMsg("%s Duration = %f seconds\n",p,duration);

// CPU id helper structure
struct CPU
	CPU() : m_r1(0), m_r2(0), m_nProc(0), m_r3(0), m_r4(0), m_r5(0) {Init();}
	CPU(int nProc) : m_r1(0), m_r2(0), m_nProc(nProc), m_r3(0), m_r4(0), m_r5(0) {Init();}
	~CPU() {};
	CPU(const CPU & rhs) {*this = rhs;}
	CPU & operator = (const CPU & rhs)
		if (this != &rhs)
			m_r1 = rhs.m_r1;
			m_r2 = rhs.m_r2;
			m_nProc = rhs.m_nProc;
			m_r3 = rhs.m_r3;
			m_r4 = rhs.m_r4;
			m_r5 = rhs.m_r5;
		return *this;
	void Init() {__cpuid((int*)this,1);}
	int GetNbProcs() {return m_nProc;}
	int GetNbThreads() {return min(GetNbProcs() * 4,MAXTHREADS);}

	unsigned m_r1 : 32;
	unsigned m_r2 : 16;
	unsigned m_nProc : 8; // Number of logical processors
	unsigned m_r3 : 32;
	unsigned m_r4 : 32;
	unsigned m_r5 : 4;
	unsigned m_HT : 1; // multi-threading / hyperthreading bit
	unsigned m_r6 : 3;

// Compression helper structure
struct CompressionInfo
	char * m_pInBuffer;
	DWORD m_dwSrcBytes;
	char ** m_ppOutBuffer;
	DWORD * m_pdwOutBytes;

void InitVersion();
BOOL IsWinVerOrHigher(ULONG mj, ULONG mn);
DWORD VersionMajor();
DWORD VersionMinor();

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


About the Author

Andy Bantly
United States United States
Working as a software developer since 1989. Started out with Basic, FORTRAN and JCL, moved into Visual Basic 1.0, C, then C++, and now I work mainly in C++ using MFC, Win32, and ATL/COM. I use Microsoft Products only because that is what gives me gainful employment. Through work, I have a lot of experience with HTML, JavaScript, XSL transformations, the XMLHTTP object, PHP 4.x, and simple COM object integrations.
I've worked for the University of Oklahoma in the school of meteorology (Go SOONERS!), consulting, and now as a Senior Software Engineer. These things keep my lights on and electricity going. My dream job is to own a bowling alley and rub elbows with pro-bowlers! I'm also an avid pedicab driver and have my own cab. I like the hustle of picking up people in downtown and biking them to their destination.
Follow on   Google+   LinkedIn

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.150302.1 | Last Updated 20 Sep 2013
Article Copyright 2000 by Andy Bantly
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid