Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question regarding shortcuts. Can

Status
Not open for further replies.

tedsmith

Programmer
Nov 23, 2000
1,762
AU
Question regarding shortcuts.
Can somebody explain the following?

I use TightVNC remote desktop to see other computers.
When you first connect you have to start VNCViewer.exe and enter the IP address or name of the other computer then you can store this as a shortcut.

Subsequently all you have to do is to click on this shortcut to establish a connection - very convenient.
The shortcut produced has a file name like of 123.234.345.456.vnc
When I examine the shortcut with notepad I see it is like a batch file containing the IP address and port and other parameters but no mention of the VNCViewer.exe file needed to start it.

How does this work? Has VNC somehow also made an entry in the registry that treats the shortcut like an executable or is there other hidden code in the shortcut that notepad won't reveal?
 
Thanks
I wasn't looking for code but rather an explanation of how it works.
 
The file extension "VNC" has been associated with VNCViewer.exe, just like Microsoft Word is usually associated with the .DOC extension. Associating file extensions with particular executables has been part of the Windows operating systems for a very long time.
Right click on a file and choose "Open With..." --> "Choose Program..." - in the dialog that follows there is a checkbox "Always use the selected program to open this type of file". That is one way to set the association manually, David has shown the programmatic way.
 
I was only wondering how it did it because VNC needs no "installation".

As VNC has no "installation program" as such, are you saying that the first time you run it, it adds an entry to the registry to effectively add VNC to the list of associations?


 
I guess that is how it happened. You don't need to be an "installation" program to write to the registry.
 
Yes I just didnt twig that this is what they did.

In some of my apps I have included the option to automatically write to the Run section so a program will run on startup without having to add it to the Startup folder.

In another that silently monitored the usage by students, I added it to Run (if not there) every time the app was started so a student couldn't erase it from the startup folder.
It is easy to remove from Startup but not too many people know how to edit the registry even if they have permission to view it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top