×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

More on RDP and VB.Net

More on RDP and VB.Net

More on RDP and VB.Net

(OP)
I'm in VS 2008 VB.NET

I have a form with the RDP control on the form.  In the Form1_Load event I set the parameters to connect:

        rdp6.Server = "10.1.1.1"
        rdp6.UserName = "abc"
        rdp6.AdvancedSettings2.ClearTextPassword = "def"
        rdp6.Connect()

It connects and I see the remote system.  Now on the remote I logoff.  Fine.

What I would like to do is detect the disconnect and close down the executing program.  So I use one of the RDP events:


    Private Sub rdp6_OnDisconnected(ByVal sender As Object, ByVal e As AxMSTSCLib.IMsTscAxEvents_OnDisconnectedEvent) Handles rdp6.OnDisconnected
        Me.Close()
    End Sub


It appears to want to do the job but I get an error:

AccessViolationException was unhandled

Attempt to read or write protected memory.  This is often an indicate that other memory is corrupt.


OK, sure.  I got no idea.


 

RE: More on RDP and VB.Net

Is the program you are trying to close running on the client or the server? I'd guess it's on the server, and TBH you shouldn't really be auto-closing OnDisconnected (it's too late anyway) - it might be just a network glitch, not a "proper" Close.

Likewise, if you're doing that on the client, every time someone reboots a router your program's going to boot you out to the desktop without warning - still not good.

And BTW Me.Close will close the active form but not necerrily the entire program.

I used to be the Comaboy on Tek-Tips.

...And the despicable Jeremy Vyle elsewhere. ;)

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close