Please see this article entitled: How VNC, Fog Creek Copilot and other remote control software works.
I will provide some additional detail here, from what that blog post says, but that is more specific to the Fog Creek Copilot source code. All of this data was taken from looking at the source code.
Basically Copilot was not written from scratch in C++ but instead it was built off of the GPL'ed TightVNC. Yes this means that Copilot's main source must also be given out. You can get the Fog Creek copilot source code here. And as far as I understand, you could build your solution off of this project's source code as long as you made it GPL as well.
The project is split into a Mac version and a Windows version. The Mac version is built in objective C and the windows version is built in Win32 C++ (not MFC). For the windows version there is a Helper solution made in VS 2008 and a Host solution (the host is the person being helped) made in VS 2008. I think they didn't use Trolltech's Qt because of it's large linking size, it was important to them to keep the download very small since it had to originally be downloaded by everyone helping someone and everyone needing help each time.
There is no x64 nor IA64 configurations, so all of the code on Windows runs only as an x86 process. It can run on a 64bit windows though through WOW64 just as any other 32-bit process can use.
As I understand, development was done with the Host running on a VM for the most part. The development of the Helper was done on their desktop.
The Copilot source code uses boost 1.38, and several other 3rd party libraries. These libraries include STUNT for NAT traversal, MatrixSSL, libntlm (Library for Microsoft's NTLM authentication) and omnithread (threading and synchronisation library).
For the most part it uses bsd style sockets, but it also has some networking code in boost::asio. This is problematic because boost::asio 1.38 has a lot of bugs in it that are fixed in boost 1.40. The project has a windows hook dll as well to hook keyboard, mouse and other windows messages on the host.
There is a shell project which is not like the windows shell but that basically contains 3 binaries: the host, deleter and hooks dll. It extracts these.
What they don't give out is the source code for the Reflector and website, which as I understand from some blog posts on projectaardvark.com, they are both in C#, Everything else in C++. The purpose of the reflector is to assist in NAT traversal. The new blog which replaces projectaardvark.com by the way is called Air Traffic.
VNC is bassed off of the remote framebuffer protocol. The RFB protocol itself isn't that difficult if you have a lot of protocol experience.