ULTR@VNC VIEWER ACTIVEX CONTROL
For my product GoToTerminal, I needed a VNC Client (in the form of an ActiveX control) in order to add VNC support to GoToTerminal.
After a quick search in Google, I discovered that there is any free VNC ActiveX Client, so I decided to take the standard Windows Ultr@VNC client and convert it to an ActiveX Control. The very good quality of the implementation (from an object oriented point of view) dramatically simplified my job. The entire conversion took 3 days. This is a screenshot of the GoToTerminal Control Panel, using my VNC ActiveX Client:
These are the properties and methods exposed by the control:
[id(1)] HRESULT Connect();
[id(2)] HRESULT Disconnect();
[propget, id(3)] HRESULT Connected([out, retval] BOOL *pVal);
[propget, id(4)] HRESULT Server([out, retval] BSTR *pVal);
[propput, id(4)] HRESULT Server([in] BSTR newVal);
[id(5)] HRESULT ExecuteCommand( [in] BSTR cmdText, [out,retval] BSTR *pRetVal );
[propget, id(6)] HRESULT IsInitialized([out, retval] BOOL *pVal);
There are 2 events supported by the ActiveX control:
[id(1)] HRESULT OnConnected();
[id(2)] HRESULT OnDisconnected(BSTR reason);
As I said above, the conversion itself was so easy that I was able to clearly isolate all my changes to the code, in a way that preserves the dual compilation of both my ActiveX ATL project and of the original Win32 client. All the changes and additions to the original code are controlled by a preprocessor symbol (_ULTRAVNCAX_), that was also a good way I used to mark all the points in the code where actually I made changes, thus simplifying the conversion of future versions of the VNC client to this ActiveX form.
In the “UltraVncAx” folder you can find the ATL code specific to the ActiveX version of the client. Most noticeably, you can find here the code that relays some relevant Windows messages from the ActiveX control to the VNC client child window and the code that hooks the keyboard (through SetWindowsHookEx/WH_KEYBOARD) in order to correctly dispatch the user input messages to the VNC client (when the ActiveX is focused), in the case when the client is hosted in a complex ActiveX Control Container, such as Internet Explorer.
My ActiveX VNC client, as well as the original Win32 VNC viewer, is licensed under the terms of the GNU General Public License (GPL).
You can download the source code of the Ultr@VNC ActiveX Client from here.
You can download the binary version of the Ultr@VNC ActiveX Client from here.
Also take a look at my Telnet Client ActiveX Control, derived from the excellent PuTTY client.