在Applet中加载ActiveX对象 [英] load ActiveX object in Applet

查看:225
本文介绍了在Applet中加载ActiveX对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网络应用程序,用于处理从专用麦克风接收的事件和音频。音频由在网页中运行的Java小程序处理,但其他事件(连接的麦克风,麦克风断开连接,麦克风按钮按下)由ActiveX对象处理。

I have a web application that processes events and audio received from a specialised microphone. The audio is processed by a Java applet that runs in the web page, but other events (microphone connected, microphone disconnected, microphone button pressed) are handled by an ActiveX object.

ActiveX对象捕获这些事件并调用JavaScript代码来处理它们

The ActiveX object traps these events and calls JavaScript code to handle them

<!-- Load the ActiveX control -->
<object id="PhilipsSpeechMikeCtrl" width="0" height="0" tabindex="-1"
    classid="CLSID:AAA44754-CC81-4692-91AF-7064E58EB22A"
    standby="Loading Philips SpeechMike component..."
    type="application/x-oleobject">
</object>

<script type="text/javascript">
    // This is Microsofts javascript way of trapping ActiveX object events.

    function PhilipsSpeechMikeCtrl::SPMEventDeviceConnected(deviceID) {
        // Call JavaScript code to handle the microphone connected event
    }

    function PhilipsSpeechMikeCtrl::SPMEventDeviceDisconnected(deviceID) {
        // Call JavaScript code to handle the microphone disconnected event
    }

    function PhilipsSpeechMikeCtrl::SPMEventButton(deviceID, eventId) {
        // Call JavaScript code to handle the microphone button pressed event
    }
</script>

当然,这种方法的一个问题是它完全取决于IE。我喜欢在applet中加载ActiveX对象,在那里捕获事件,并在applet中处理事件,或者从applet调用的JavaScript代码。这应该使我能够在任何支持applet的浏览器中运行应用程序。

Of course a problem with this approach is that it's completely IE dependent. I would prefer to load the ActiveX object within the applet, trap the events there and handle the events either within the applet, or JavaScript code called from the applet. This should then enable me to run the app in any browser that supports applets.

我不完全确定如何去实现我上面提出的解决方案,任何建议?

I'm not entirely sure how to go about implementing the solution I've proposed above, any suggestions?

更新:我意识到上面提出的解决方案仍然是依赖于IE,这很好。我的最近的目标是支持Windows上的所有浏览器。

Update: I realise the solution I've proposed above would still be IE dependent, that's fine. My immediate goal is to support all browsers on Windows.

有人建议不使用ActiveX,而是使用JNI(或JNA)来访问ActiveX对象的DLL。但是,我实际上不想调用DLL中的函数,我想让DLL调用我,即注册一个事件处理程序。

It has been suggested that instead of using ActiveX, I could use JNI (or JNA) to access the DLLs underlying the ActiveX object. However, I don't actually want to call the functions in the DLLs, I want the DLLs to call me, i.e. register an event handler.

谢谢,
Don

Thanks, Don

推荐答案

ActiveX不支持IE以外的浏览器,因此您的应用程序无法支持所有浏览器,即使仅在Windows上。
在Firefox 1端口尝试(插件)端口ActiveX,但是没有真正有用的,因为我知道,今天没有仿真解决方案你的问题。
抱歉...
(请参阅这里 Mozilla评论)

ActiveX are not supported by an another browser than IE, so there is no way for your application to support all browsers, even on Windows only. An attempt (plugin) to port ActiveX under Firefox 1 was made, but wasn't really useful so as far as I know, there is today no "emulation" solution to your question. Sorry... (see here for Mozilla comments)

这篇关于在Applet中加载ActiveX对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆