Update: UltraVNC 1.4.3.6 and UltraVNC SC 1.4.3.6: https://forum.uvnc.com/viewtopic.php?t=37885
Important: Please update to latest version before to create a reply, a topic or an issue: https://forum.uvnc.com/viewtopic.php?t=37864

Join us on social networks and share our announcements:
- Website: https://uvnc.com/
- GitHub: https://github.com/ultravnc
- Mastodon: https://mastodon.social/@ultravnc
- Bluesky/AT Protocol: https://bsky.app/profile/ultravnc.bsky.social
- Facebook: https://www.facebook.com/ultravnc1
- X/Twitter: https://x.com/ultravnc1
- Reddit community: https://www.reddit.com/r/ultravnc
- OpenHub: https://openhub.net/p/ultravnc

Custom VB.NET app connecting to the PCHW DLL

Post Reply
stevesobol
Posts: 3
Joined: 2007-03-10 17:51

Custom VB.NET app connecting to the PCHW DLL

Post by stevesobol »

I am pleased to report that I have a small VB .NET app that successfully initiates a connection using PCHelpware.

I really only have one problem at this point. I call Start_server, and the remote desktop is displayed and I can do my work on the remote computer -- but the calling app freezes! The window won't even redraw...

My code looks like this

Code: Select all

Imports System.Runtime.InteropServices

Public Class Form1
    <DllImport("kernel32", CallingConvention:=CallingConvention.Cdecl)> _
        Private Shared Function LoadLibrary(ByVal lpFileName As String) As IntPtr
    End Function

    <DllImport("kernel32", CallingConvention:=CallingConvention.Cdecl)> _
    Private Shared Function FreeLibrary(ByVal hModule As IntPtr) As Boolean
    End Function

    <DllImport("kernel32.dll")> _
    Private Shared Function GetProcAddress(ByVal hModule As IntPtr, ByVal lpProcName As String) As UIntPtr
    End Function

    <DllImport("1SCDLL.DLL")> _
    Private Shared Sub Start_server( _
      ByVal Id As String, _
      ByVal Repeater As String, _
      ByVal Hostname As String, _
      ByVal Port As Integer, _
      ByVal Password As String, _
      ByVal Proxy As Boolean)
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim hInst As IntPtr = LoadLibrary("c:\sc\1SCDLL.dll")
        Dim ssAddress As UIntPtr

        If (hInst) Then
            ssAddress = GetProcAddress(hInst, "Start_server")
            If ssAddress <> UIntPtr.Zero Then
                Start_server("", "", "localhost", 5500, "827CCB0EEA8A706C4C34A16891F84E7B", False)
            Else
                MsgBox("Couldn't load SC DLL")
                FreeLibrary(hInst)
            End If
        End If
    End Sub
End Class
Also, how do I determine if something blows up inside Start_server? For example, how can I find out if, for example, my PCHW viewer isn't running? Are there any docs besides the little bit of code on the PCHW website?

Thanks in advance
Last edited by stevesobol on 2007-03-16 04:18, edited 1 time in total.
User avatar
Rudi De Vos
Admin & Developer
Admin & Developer
Posts: 6867
Joined: 2004-04-23 10:21
Contact:

Re: Custom VB.NET app connecting to the PCHW DLL

Post by Rudi De Vos »

I hopes this give the needed info
[post=35927][/post]
stevesobol
Posts: 3
Joined: 2007-03-10 17:51

Re: Custom VB.NET app connecting to the PCHW DLL

Post by stevesobol »

Rudi De Vos wrote:I hopes this give the needed info
[post=35927][/post]
Wow! Yes, it does help a little bit. Though I am not sure it will solve the problem, it's definitely stuff I wanted to know. Fortunately I know C too. :)

Once I get this all running, I think I'll contribute the code back to the community. I'll keep working on it and update this thread as necessary.
RitScott
Posts: 1
Joined: 2007-11-29 19:41

Re: Custom VB.NET app connecting to the PCHW DLL

Post by RitScott »

I am a VB.NET Developer and was just wondering if you got anything working yet. I am attempting to make a version in VB.NET myself.
Post Reply