| Dart Home | PowerTCP Emulation for ActiveX | Custom Development | Reply | PowerTCP Emulation / Telnet for ActiveX Topics | Forums |
| Author | Forum: PowerTCP Emulation / Telnet for ActiveX Topic: unable to unload telnet object properly (vb6 ) |
| mushu From: Orting, WA USA Posts: 17 Member Since: 10/06/04 |
posted October 27, 2004 2:35 PM Here is a snippet of code: If Not DoBlockingConnect(addr(curSite), 23, 15000) Then MsgBox "Unable to connect to telnet server...perhaps a hardware problem?", vbCritical + vbOKOnly, "OOPS!" Telnet1.Close Telnet1.Abort Unload Me frmMain.mnuStop.Enabled = False frmMain.mnuRun.Enabled = True Else Telnet1.Send (vbCrLf + vbCrLf) End If Now, if there really is a problem with the telnet server I'm attempting to connect with, this routine above doesn't seem to do anything. I thought I needed to add some delay before & after the .close and .abort commands, so I added a Sleep(1) between them, and it still doesn't give me back "control". What am I missing? |
| mushu From: Orting, WA USA Posts: 17 Member Since: 10/06/04 |
posted October 27, 2004 2:36 PM Clarification: the code _does_ do stuff, but it doesn't stop/abort/unload the telnet object. |
Tony Priest![]() From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted October 27, 2004 2:42 PM I'm not sure exactly what you are trying to report, but I can tell you that the form should not unload because immediately after calling Unload you do stuff with form items (mnuStop for example) which will cause the form to "reload" |
| mushu From: Orting, WA USA Posts: 17 Member Since: 10/06/04 |
posted October 27, 2004 3:14 PM Sorry, this code is from a different form, and it is setting the parent form's menu button options. But I didn't catch the typo of switched commands -- they should have been before the unload. My question is, I can't seem to get the telnet object to unload when the form that is using it has been told to unload. It prevents the form from unloading, and I think it is something to do with an internal timeout value or something...? |
Tony Priest![]() From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted October 27, 2004 3:21 PM Calling abort should do it. Try to see if you can get the sample app to behave the same way. If you can, let me know what to do and I'll see if I can figure it out. |
| mushu From: Orting, WA USA Posts: 17 Member Since: 10/06/04 |
posted October 27, 2004 3:44 PM Thanks. In your sample code, you have some type of fancy Timer1 stuff going on, with a 300ms time value being used for some reason....what's up with that? Do I need to pause a bit after sending the .Close and .Abort commands to the telnet object? |
Tony Priest![]() From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted October 27, 2004 3:55 PM Yes, that's right, I forgot about that. VB has problems unloading if the connection is still being torn down. The purpose of that code was to get out of the event and call close again via the timer. You may want to try implementing something like that. |
| mushu From: Orting, WA USA Posts: 17 Member Since: 10/06/04 |
posted October 27, 2004 4:21 PM Ok. Can I simulate that by inserting a Sleep(3) after both the .Close and .Abort commands to get away with a cheap solution? I don't want to have to trace your code and figure out how to use the Killing flag and put a Timer object on my form, etc, etc.... |
Tony Priest![]() From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted October 27, 2004 4:27 PM I'm not sure as I have never tried it. It sounds like it's worth trying though. Let me know if it works. |
| Reply | PowerTCP Emulation / Telnet for ActiveX Topics | Forums |
This site is powered by
PowerTCP WebServer for ActiveX
|