Solved

vncviewer.exe in vb app

Posted on 2004-08-31
9
695 Views
Last Modified: 2008-02-01
Hi I have vnc running in all computers in my network. I have a managing application that I created and I just want to know if it's possible to implement vnviewer to it. I just want a simple example of how can I call on the viewer with a specific computer name and password. If possible also to be able change some of the settings like full screen. Please tell me this is possible.
0
Comment
Question by:DARKSAGES
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
9 Comments
 
LVL 7

Expert Comment

by:jacobhoover
ID: 11945895
There are some command line switches to the viewer but you can also save the connection information as a .vnc file.  If you looked at the format of the .vnc file it would be possible to dynamically create the file and then just shell to vnc passing it the path to the .vnc file.
0
 
LVL 7

Expert Comment

by:jacobhoover
ID: 11947124
Other options include:
/8bit
/shared
/noshared
/swapmouse
/belldeiconify
/listen
/fullscreen
/viewonly
/emulate3
/scale a/b
/config configfile  <-- This was the one I was talking about
/encoding encname
/compresslevel n
/quality n
/nocursorshape
/noremotecursor
 server[:display]
0
 
LVL 7

Expert Comment

by:jacobhoover
ID: 11947287
Option Explicit
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long


Private Const SYNCHRONIZE = &H100000
Private Const INFINITE = &HFFFF      '  Infinite timeout

Const PathToVNCViewer = "C:\<<Path Too>>\tightvnc-1.2.2_x86_viewer\vncviewer.exe"
Public Sub Connect(szMachine As String)
  Call ShellAndWait(PathToVNCViewer & " /8bit /shared /viewonly " & szMachine, vbNormalFocus)
End Sub

' Start the indicated program and wait for it
' to finish, hiding while we wait.
Private Sub ShellAndWait(ByVal program_name As String, _
    ByVal window_style As VbAppWinStyle)
Dim process_id As Long
Dim process_handle As Long

    ' Start the program.
    On Error GoTo ShellError
    process_id = Shell(program_name, window_style)
    On Error GoTo 0

    ' Hide.
    Me.Visible = False
    DoEvents

    ' Wait for the program to finish.
    ' Get the process handle.
    process_handle = OpenProcess(SYNCHRONIZE, 0, process_id)
    If process_handle <> 0 Then
        WaitForSingleObject process_handle, INFINITE
        CloseHandle process_handle
    End If

    ' Reappear.
    Me.Visible = True
    Exit Sub

ShellError:
    MsgBox "Error starting task " & _
        program_name & vbCrLf & _
        Err.Description, vbOKOnly Or vbExclamation, _
        "Error"
End Sub
0
Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

 
LVL 7

Expert Comment

by:jacobhoover
ID: 11947324
The only way to get the password is to have it in a .vnc file or to modify the code for the viewer itself.
0
 

Author Comment

by:DARKSAGES
ID: 11948108
where is the .vnc file located i dont see one?
0
 
LVL 7

Accepted Solution

by:
jacobhoover earned 500 total points
ID: 11948143
Open up a viewer instance then right click on the menu, once connected, and click save connection info as...

It will create a text file similar to:
[connection]
host=<machine name here>
port=5900
password=<encoded password here>
[options]
use_encoding_0=1
use_encoding_1=1
use_encoding_2=1
use_encoding_3=0
use_encoding_4=1
use_encoding_5=1
use_encoding_6=1
use_encoding_7=1
use_encoding_8=1
preferred_encoding=7
restricted=0
viewonly=1
fullscreen=0
8bit=1
shared=1
swapmouse=0
belldeiconify=0
emulate3=1
emulate3timeout=100
emulate3fuzz=4
disableclipboard=0
localcursor=1
scale_den=1
scale_num=1
cursorshape=1
noremotecursor=0

So the obvious question is do you use static passwords or do they vary from machine to machine?  If they change you will have to find a means of encoding the pass into the correct format if you want to connect without having to enter it.

0
 

Author Comment

by:DARKSAGES
ID: 11948151
no the password is the same one for all machines
0
 

Author Comment

by:DARKSAGES
ID: 11948172
thanx
0
 
LVL 7

Expert Comment

by:jacobhoover
ID: 11948175
Also,
  the switches I listed are for TightVNC... Version 1.2.2.. There are numerious flavors of VNC available so there may be different switches available in the newer versions.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Progress

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question