How can VBA tell whether the computer is being controlled through VNC?

D

DrAvi

Hello,

My application is operated on a computer that can be controlled locally or
remotely, with RealVNC.
I want some options to be disabled when its being controlled remotely.
RealVNC is using port 5900. Is there a way I can monitor with VBA than this
port is busy? Can you advice other options and solutions?

Thank you for your time,
Avi
 
M

Magius96

I won't be able to provide you code for this, but here's a theoretical
solution for you:

Since you know what port the remote application runs on, then you should be
able to use the ever popular win-sock controls to attempt to create an open
telnet session on that port. If the remote connection exists, then an error
will be thrown. Thus, you would use a Try, Catch... procedure just before
you attempt to create the connection. If the error is present, you do
whatever is necessary to deactivate the options you don't want to have
available. If the error is not thrown, that means the port is open, then you
close down your win-sock connection and proceed with the code you need to
enable those options.
 
Top