Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to release a MSComm Active X control?
Message
From
22/05/2002 10:09:47
 
 
To
22/05/2002 03:14:47
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00659743
Message ID:
00659899
Views:
20
Hi, thanks for your quick help. If it is not the problem of releasing the OLE control, I don't know how to debug this, now I try to summrize the structure of my program to you here:

****** Init event of my form
_VFP.AutoYield=.F. && Used it because I want get the response of the modems, it will make the event pending so that I can get the response after the modem hang up.
****** Click event in a button of that form
select TableA
do while !eof()
With Thisform
....
.ocxCOMM.PortOpen = .T.
.ocxCOMM2.PortOpen = .T.
....
.Timer1.enabled = .T. && I set its interval to 2000ms so to wake up
the program again after the 15 seconds timeout by the
WaitForResponse method below.
.ocxCOMM.OUTPUT = [ATDT......
.ocxCOMM2.OUTPUT = [ATDT.....
.WaitForResponse(15) && Wait for 15 seconds for the modem connection then Doevents()
.Timer1.enabled = .F.
.AddToResult() && A method which will call INSERT statement to write the modem response to TableB.
&& Then do the above lines for the output 1 more time.
.Timer1.enabled = .T.
....
....
.Timer1.enabled = .F.
.AddToResult() && Add to TableB again.
endif
Select TableA
Skip
enddo

In the OLE object, its OnComm event is:
If this.CommEvent = 2
gString = this.Input && which will be used in .AddToResponse mentioned above.
.....
.....
Endif

That is. I have a similar VFP program that will run for hours without this problem, their difference is it has not used Timer, OLE object, AutoYield = .F. etc. So I think it is not my Windows' problem and must be some buggy thing I created in the program. Thanks for help.
Power


>This problem isn't caused by MSComm. I guess, you make some other operations with VFP (open tables in memory without closing them, etc.) or this is caused by your Windows.
>Anyway, about releasing: You can release only controls, which you added at run-time (for instance, with CreateObject() or Form1.AddObject()).Syntax is:
>
>1. If you add control using CreateObject:
>Release SomeControlName
>
>2. If you add control using AddObject:
>Form1.RemoveObject("SomeControlName")
Power Wong
Every problem will have a solution, the only problem is that can you find it out.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform