基于.net的RDP实现的远程桌面,把源代码拿出来,form1用于采集用户信息,form2用户实现桌面功能:
Public Class Form1
Dim aa As Integer = 0
Dim ab As Integer = 0
Dim ac As Integer = 0
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Form2.Show()
Me.Hide()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Button1.Enabled = False
Timer1.Enabled = True
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If aa = 1 Then
If ab = 1 Then
If ac = 1 Then
Button1.Enabled = True
Else
Button1.Enabled = False
End If
Else
Button1.Enabled = False
End If
Else
Button1.Enabled = False
End If
If Button1.Enabled = True Then
Timer1.Enabled = False
End If
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
aa = 1
End Sub
Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged
ab = 1
End Sub
Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged
ac = 1
End Sub
End Class
Public Class Form2 Private Sub AxMsRdpClient71_OnConnecting(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AxMsRdpClient71.OnConnecting End Sub Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.AutoSize = True AxMsRdpClient71.Server = Form1.TextBox1.Text AxMsRdpClient71.UserName = Form1.TextBox2.Text AxMsRdpClient71.AdvancedSettings2.RDPPort = 3389 AxMsRdpClient71.AdvancedSettings2.ClearTextPassword = Form1.TextBox3.Text AxMsRdpClient71.AdvancedSettings8.RedirectDevices = True AxMsRdpClient71.AdvancedSettings8.RedirectDrives = True 'AxMsRdpClient71.Width = AutoSize 'AxMsRdpClient71.Height = AutoSize ' AxMsRdpClient71.FullScreen = True 'AxMsRdpClient71.AdvancedSettings3.SmartSizing = True 'AxMsRdpClient71.FullScreenTitle = AxMsRdpClient71.Server + "-远程桌面" AxMsRdpClient71.Connect() End Sub End Class