Hi Bill
Thanks for the thoughtful reply. I don't have a lot of experience in unmanaged code and COMs, but also think my problem is how the webpage is using and releasing AHP. Let me give a little more detail.
Again, I have a resident program on the server that is always running. It is interfaced to a CM15a computer interface. This program "connects" to the interface by creating an object with:
ActiveHomeObj = CreateObject("X10.ActiveHome")
as you saw in the code. It can send X10 commands from within the program with the:
ActiveHomeObj.SendAction("sendplc", "m1 on") for example
and it works fine. I can also detect if an X10 module like a motion detector or a remote handheld has sent an X10 command with the:
Sub ActiveHome_RecvAction(ByVal bszRecv As Object _
, ByVal v1 As Object _
, ByVal v2 As Object _
, ByVal v3 As Object _
, ByVal v4 As Object _
, ByVal v5 As Object _
, ByVal vRes As Object) Handles ActiveHomeObj.RecvAction
since I have declared:
Dim WithEvents ActiveHomeObj As ActiveHome
in the resident program to detect events (basically an interrupt).
Inside this sub I look at what command was sent and decide on appropriate action.
This all works perfectly for the resident program.
The problem is when I attempt to have a webpage on the same server set X10 commands from the page. The VB "code behind" is basically the same as the resident program except I don't use the ActiveHome_RecvAction to detect X10 commands...only send them.
In the Webpage, I create the same AHP object and I have radio buttons that when clicked do the ActiveHomeObj.SendAction function. It is set up so that the button does an AutoPostBack. This also works fine for the Webpage.
But once the Webpage is run, the resident program does not see X10 events and the ActiveHome_RecvAction subroutine is never called. And as you say, things get crapped up.
Since there can be many postbacks and reloading of the webpage in a session (one per button click at least), I figured I was creating many X10 objects and not releasing them. I tied ActiveHomeObj.Dispose(), but that is not supported by AHP. There may be other ways to release the AHP resources, but I do not know how.
The only way to clear the problem is to reboot. So I have to fix it properly.
Hope this gives a little better picture of what I'm trying to do.
Best,
John