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
Thanks in advance