问题
I have an ActiveX control which is designed to * Search for nearby wireless networks * Create a wireless access point * Manage network adapters
I would like this plugin to work in Google Chrome/Firefox. In IE; I can use the following code to embed:
<object classid="clsid:33FC4347-8118-4DB5-BFBE-8FCF2C96A997" width="32" height="32" id="thectrl"></object>
and I create a wireless network as follows (in JavaScript): thectrl.createNetwork("test",0,null,"NONE",3); The ActiveX has an IDL file, and outputs to OCX format. How do I turn this into a plugin for Google Chrome/Firefox?
回答1:
If you want to rewrite it to support NPAPI, an easy way is to use the FireBreath framework. It gives you an abstraction over the plugin architectures, is cross-platform and allows you to support NPAPI and ActiveX from one source base.
But then again i am biased, so if you want to do it manually instead, here are some starting points:
- a three-part NPAPI tutorial
- MDC plugin section
- The "Hello World" of NPAPI plugins
回答2:
It would be best if you have the source code of the ActiveX and let the NPAPI headers expose the functionality you need. If you want to turn that into a plugin, you would definitely need C++ knowledge to create that NPAPI library.
So your only solution at this point is creating your NPAPI plugin. You might try some of the Mozilla examples at https://developer.mozilla.org/En/Plugins. If you are completely new to NPAPI though, maybe you'd want to start with https://developer.mozilla.org/en/Gecko_Plugin_API_Reference.
To start developing, all you need are the standard NPAPI headers, which you can now get from http://code.google.com/p/npapi-headers/source/browse/
An example plugin we use in Chromium: http://src.chromium.org/viewvc/chrome/trunk/src/webkit/glue/plugins/test/
来源:https://stackoverflow.com/questions/3746440/how-to-convert-activex-control-to-npapi-plugin