IEAdvancedBar work with thread ,When Debug is thrown Cannot access a disposed object

Add-in Express™ Support Service
That's what is more important than anything else

IEAdvancedBar work with thread ,When Debug is thrown Cannot access a disposed object
 
dolantin




Posts: 8
Joined: 2014-09-05
In IEAdvanceBar, I start a thread to receive socket message.

In thread :
 IEAdvanceBar.getInstance().Notfiy("xxxxxxx")


In IEAdvanceBar

public void Notify(string message) 
{
    if (this.InvokeRequired)
      {
                SetTextCallback d = new SetTextCallback(Notify);
                this.Invoke(d, new object[] { message });
      }else{
       .......
            send message to browser document
    }
}


Everything looks very good run in IE,
but I attach to debug , then throw Exception Cannot access a disposed object .
In DebugView, I can trace OnTabCreated ,active IE every time.
the IEAdvanceBar will be SetSite every time activation IE window?

When IE Bar visible= false,
How can i update browser document element?
In the thread , IEAdvanceBar.getInstance().IEApp == null
Posted 12 Sep, 2014 00:50:53 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
Hello,

Please don't change any HTML elements from a separate thread. It may cause IE crashes. Instead of this, please use SendMessage method (from a separate thread) and OnSendMessage event of the iemodule, bar module or toolbar module to update the active HTML document.

the IEAdvanceBar will be SetSite every time activation IE window?

IE creates a separate instance of an add-on/toolbar/explorer bar for each tab/window.
Posted 12 Sep, 2014 06:48:17 Top
dolantin




Posts: 8
Joined: 2014-09-05
Thanks, I change the update UI method just like AdvanceSearch Demo.


But in the ADXIEModule instance ,I instantiated some classes, those include
socket and other resources are singleton .

About module instances of management ,I am very confused,
How can I share the status between the ADXIEModule instances,
How can I identify the instance that owner the socket or resources?
Posted 22 Sep, 2014 00:51:47 Top
Andrei Smolin


Add-in Express team


Posts: 14106
Joined: 2006-05-11
Hello Dolantin,

There are three communication "lines" between instances of the ie module (bar module or toolbar module):
- an instance can use the SendMessage, SendMessageToInstance and SendMessageToAll methods to inform other instances about the change of status or such
- an instance can use the SendDataToBroker method to send a request to the broker application and to handle the response; this is useful when storing a single data instance on the broker
- you can also use the ADXIESharedMemory class as demonstrated in HowTo: Synchronize settings of an IE plug-in

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 22 Sep, 2014 05:37:10 Top
dolantin




Posts: 8
Joined: 2014-09-05
Thanks ,Andrei!

The broker application maybe is closed to my solution.

In the broker project,
Can retrieve all the ie module instances?
Or broker appliation send data just like SendDataToBroker in the IE Module?
(Now I can sendMessage by win32 func)

I test my broker demo,
I set IEModule.BrokerGuid in designer panel,
run IE will throw Exception,if broker app is not running :

Assembly Version:      9.1.6122.0

Exception Source:      
Exception Type:        AddinExpress.IE.ADXIEBrokerApplicationException
Exception Message:     The broker application is not found.
Exception Target Site: Object reference not set to an instance of an object.


I set it in code ,the SendDataToBroker return is false.
this.BrokerGuid = "{92FFAE19-20CA-43D2-BE22-EDD9EE7A3961}";
            bool bRet = this.SendDataToBroker(request, out response);




BTW, in pro source code, I didn't find the ADXIEBrokerModule source code .
How can I get it?
Posted 22 Sep, 2014 08:57:52 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
Hello Dolantin,

Did you rebuild the plugin and the broker project after you changed the BrokerGuid property?


Can retrieve all the ie module instances?

No, iemodule instances and the broker module work in different integrity levels.
But you can use the ActiveConnections property to get some details about opened IE tabs/windows (e.g. TabWindowHandle, ProcessID and so on). Please use the SendDataToBroker method to communicate with the broker app.
Posted 23 Sep, 2014 10:12:10 Top