Wednesday, June 20, 2012 5:03 AM
Thursday, June 21, 2012 12:40 AM
If you navigate away from the page that contains your ActiveX, then the ActiveX is closed and released (same cannot be said for the object created in script, there's a GC involved).
If your implementation of DllCanUnloadNow is correct, then your ActiveX will be unloaded at idle time, in a matter of minutes. If you feel it is not often enough, you can call CoFreeUnusedLibraries, but you need to call the function in the process that loads the ActiveX, which means you need to have another COM object running in the process. If you plan to update the updater COM object too, then you probably want to see if the user can download your ActiveX's installer and just close all IE windows like Adobe does for Flash.
The following is signature, not part of post
Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
Visual C++ MVP
- Edited by Sheng Jiang 蒋晟MVP Thursday, June 21, 2012 12:40 AM
Thursday, June 21, 2012 12:39 PM
Thanks for the reply. I see that I cannot upgrade the plugin in a new window. But I have figured out that it is possible to upgrade it seamlessly after detecting the install/upgrade in the same page.
So first time embed the ActiveX without CODEBASE to just detect the install/upgrade requirement.
document.getElementById('pluginObject').innerHTML = "<OBJECT id='ActiveXObj' CLASSID='XXXXX-XXXXXX-XXXXXXX-XXXXXXX-XXXXX'/>" // without CODEBASE var activeXControl = document.getElementById ('ActiveXObj'); var version = activeXControl.getVersionAPI (); // need to be implemented by the ActiveX Control and return the version.
Then check the current version vs the version downloaded from server to decide if we require a upgrade.
Now after detecting depending on the findings, again embed to the same html element with CODEBASE (URL + version) to trigger the install/upgrade.
document.getElementById('pluginObject').innerHTML = "<OBJECT id='ActiveXObj' CLASSID='XXXXX-XXXXXX-XXXXXXX-XXXXXXX-XXXXX' CODEBASE'<URL>#Version=X.X.X.X'/>" // with CODEBASE to trigger the install/upgrade.