Acties:
  • 0 Henk 'm!

  • Mike2k
  • Registratie: Mei 2002
  • Laatst online: 22-08 11:59

Mike2k

Zone grote vuurbal jonge! BAM!

Topicstarter
Ik ben bezig een remote desktop applicatie te ontwikkelen, een beetje in de stijl van mRemote (http://www.mremote.org/wiki/MainPage.ashx)

Nu ben ik bezig met de remote desktop verbinding, maar ik krijg constant de volgende error:

Exception of type 'System.Windows.Forms.AxHost+InvalidActiveXStateException' was thrown

Google geeft aan dat het kan komen omdat het object nog niet gecreeërd is.
De relevante code:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Imports AxMSTSCLib

Public Class main
    Dim rdpConnection As New AxMsRdpClient7

Public Sub rdpConnect(ByVal hostname As String, Optional ByVal username As String = Nothing, Optional ByVal password As String = Nothing)
        Try
            Dim newTabPage As New TabPage()
            newTabPage.Text = hostname
            rdpConnection.Dock = DockStyle.Fill
            rdpConnection.DesktopHeight = newTabPage.Height
            rdpConnection.DesktopWidth = newTabPage.Width
            rdpConnection.AdvancedSettings7.AuthenticationLevel = 2
            If username <> "" Then
                rdpConnection.UserName = username
            End If
            rdpConnection.Server = Addr.ToString
            rdpConnection.Connect()
            tcMain.TabPages.Add(hostname, hostname)
            newTabPage.Controls.Add(rdpConnection)
        Catch ex As Exception
            dgErrors.Rows.Add(ex.Message)
        End Try
    End Sub


Ik heb al geprobeerd om dit:
code:
1
rdpConnection.CreateControl()
toe te voegen, maar dan krijg ik alleen een leeg tabblad...

Kan iemand me hierbij helpen ?

You definitely rate about a 9.0 on my weird-shit-o-meter
Chuck Norris doesn't dial the wrong number. You answer the wrong phone.


Acties:
  • 0 Henk 'm!

  • SierdW
  • Registratie: April 2004
  • Laatst online: 29-11-2024
Ik heb het even geprobeerd en krijg dezelfde melding. Als ik echter het object er via de toolbox op sleep werkt het vloeiend. Het is even de vraag hoe je het object moet aanmaken

code:
1
Dim rdp As AxMsRdpClient6 = New AxMsRdpClient6()

werkt in ieder geval ook niet...

Acties:
  • 0 Henk 'm!

  • Mike2k
  • Registratie: Mei 2002
  • Laatst online: 22-08 11:59

Mike2k

Zone grote vuurbal jonge! BAM!

Topicstarter
Het rare is ook, dat ik een ander project heb waar ik het ook in gebruik, en daar werkt het vloeiend...Ik heb al naar de code gekeken, maar die is het zelfde...

You definitely rate about a 9.0 on my weird-shit-o-meter
Chuck Norris doesn't dial the wrong number. You answer the wrong phone.


Acties:
  • 0 Henk 'm!

  • Ventrigo
  • Registratie: Juli 2004
  • Niet online

Ventrigo

Het is zeker mijn tube !

Ik heb geen verstand van programmeren, maar heb je hetzelfde programma gebruikt voor het programmeren en voor het opslaan? Heb je het als dezelfde extensie opgeslagen? Is het mogelijk dat je allebei de programma's hier upload/link plaatst?

Self reflection is the school of wisdom


Acties:
  • 0 Henk 'm!

  • Mike2k
  • Registratie: Mei 2002
  • Laatst online: 22-08 11:59

Mike2k

Zone grote vuurbal jonge! BAM!

Topicstarter
Beide programma's zijn geschreven in Visual Studio 2008.
Hier is de code van beide programma's

NaView (deze werkt)
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
Imports AxMSTSCLib
Imports naview.regAction
Imports System.Net

Public Class rdp
    Dim rdpConnection As New AxMsRdpClient6
    'Dim regAction As New regAction

    Public Sub newConnection()
        If newRDPCon.ShowDialog() = Windows.Forms.DialogResult.OK Then
            Dim hostname As String = newRDPCon.tbConnect.Text
            Dim username As String = newRDPCon.tbUsername.Text
            rdpConnect(hostname, username)
        End If
    End Sub

    Public Sub rdpConnect(ByVal hostname As String, ByVal username As String)
        Try
            Dim Addr = Dns.GetHostEntry(hostname).AddressList(0)
            Dim newTabPage As New TabPage()
            newTabPage.Text = hostname
            tcMain.TabPages.Add(newTabPage)
            newTabPage.Controls.Add(rdpConnection)
            rdpConnection.Dock = DockStyle.Fill
            rdpConnection.DesktopHeight = "600"
            rdpConnection.DesktopWidth = "800"
            rdpConnection.AdvancedSettings7.AuthenticationLevel = 2
            If username <> "" Then
                rdpConnection.UserName = username
            End If
            rdpConnection.Server = Addr.ToString
            rdpConnection.Connect()
        Catch ex As Exception
            MsgBox(ex.Message & ".", MsgBoxStyle.Exclamation, "NaView - An error has occurred")
        End Try
    End Sub
    Private Sub rdp_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub mmNewCon_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mmNewCon.Click
        newConnection()
    End Sub

    Private Sub mmClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mmClose.Click
        Me.Close()
    End Sub
End Class


Code van PRCM (werkt niet)
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Imports AxMSTSCLib
Imports System.Net
Imports PRCM.clsRegistry

Public Class main
    Dim rdpConnection As New AxMsRdpClient6
    Dim regAction As New clsRegistry

    Public Sub newRDPConnection()
        If newRDP.ShowDialog() = Windows.Forms.DialogResult.OK Then
            Dim hostname As String = newRDP.tbHostname.Text
            Dim username As String = newRDP.tbUsername.Text
            rdpConnect(hostname)
        End If
    End Sub

    Public Sub rdpConnect(ByVal hostname As String)
        Try
            Dim newTabPage As New TabPage()
            Dim Addr = Dns.GetHostEntry(hostname).AddressList(0)
            newTabPage.Text = hostname
            tcMain.TabPages.Add(hostname, hostname)
            newTabPage.Controls.Add(rdpConnection)
            rdpConnection.Dock = DockStyle.Fill
            rdpConnection.DesktopHeight = newTabPage.Height
            rdpConnection.DesktopWidth = newTabPage.Width
            rdpConnection.AdvancedSettings7.AuthenticationLevel = 2
            'If username <> "" Then
            'rdpConnection.UserName = username
            'End If
            rdpConnection.Server = Addr.ToString
            rdpConnection.Connect()
        Catch ex As Exception
            dgErrors.Rows.Add(ex.Message)
        End Try
    End Sub

You definitely rate about a 9.0 on my weird-shit-o-meter
Chuck Norris doesn't dial the wrong number. You answer the wrong phone.