Method and system for operating ActiveX control in Linux system environment

By using the control usage module, control running module and interactive proxy middleware under the Linux system, the creation, display and event processing of ActiveX controls are realized, which solves the problem of running ActiveX controls in the Linux environment and ensures the effectiveness of the browser and the control. Interactions and user actions are reflected.

CN118567739APending Publication Date: 2024-08-30SILK ROAD INFORMATION PORT CLOUD COMPUTING TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410538277.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-30
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

In the Linux system environment, existing technology cannot effectively run ActiveX controls. Especially in the Firefox browser developed based on Mozilla and using the NPAPI 1.0 framework, it is impossible to create and initialize control objects, display controls, access control properties and methods, and capture and handle control events.

Method used

A system is adopted, including a control usage module based on Linux system, a control running module based on Windows system and interactive proxy middleware. It is connected to the interactive proxy middleware through browser plug-in and AxHost control container to realize the creation, initialization and creation of ActiveX controls. Display, property and method access, and event handling.

Benefits of technology

It implements the running and display of ActiveX controls under the Linux system to ensure real-time reflection of user operations, and provides a cross-system interaction mechanism through interactive proxy middleware to solve the interoperability problem between browsers and ActiveX controls.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118567739A
    Figure CN118567739A
Patent Text Reader

Abstract

The invention discloses a method and system for running an ActiveX control in a Linux system environment, and relates to the technical field of ActiveX control running. A browser plug-in is created in a browser, and ActiveX control information is obtained; the method comprises the following steps: establishing an AxHost control container, receiving ActiveX control information through interactive agent middleware, establishing an ActiveX control, and carrying out initialization; displaying ActiveX control information on a browser and activating the ActiveX control information; and the browser indirectly accesses the attribute and method of the ActiveX control through the interaction agent middleware, receives event information sent by the ActiveX control, and processes the event of the ActiveX control. According to the method, the browser plug-in and the AxHost control container are created, and the ActiveX control is operated in the Linux environment through the interactive agent middleware.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of ActiveX control operation, and more particularly to a method and system for operating ActiveX controls in a Linux system environment. Background Art

[0002] Since ActiveX controls are common components based on COM, developers can use them to easily build graphical user interfaces and use the classes they provide to create various objects, and call the properties and methods of the objects and respond to the events of the objects. However, ActiveX controls cannot be run in a Linux environment. For example, the Firefox browser developed by Mozilla using the NPAPI 1.0 framework cannot run ActiveX controls in a Linux environment.

[0003] To implement browser support for ActiveX controls in a Linux environment, four issues must be addressed, including how to create and initialize control objects, how to display and activate controls on the spot in a browser, how to enable JavaScript to access control properties and methods, and how to capture control events and forward them to JavaScript.

[0004] Therefore, in a Linux system environment, how to enable a browser to run ActiveX controls across systems is a problem that those skilled in the art need to solve urgently. Summary of the invention

[0005] In view of this, the present invention provides a method and system for running ActiveX controls in a Linux system environment.

[0006] In order to achieve the above object, the present invention provides the following technical solutions:

[0007] A system for running ActiveX controls in a Linux system environment, comprising a control use module based on a Linux system, a control running module based on a Windows system, and an interactive proxy middleware;

[0008] The control usage module includes a browser and a browser plug-in, which constitute the usage environment of the ActiveX control. The browser is connected to the interactive proxy middleware through the browser plug-in. The browser is a browser using the NPAPI 1.0 framework.

[0009] The control running module includes an AxHost control container and an ActiveX control, which constitute the running environment of the ActiveX control. The ActiveX control is connected to the interactive proxy middleware through the AxHost control container.

[0010] The interactive proxy middleware includes a control usage module proxy WindowsAgent deployed in the control usage module and a control running module proxy LinuxAgent deployed in the control running module. WindowsAgent is connected to the AxHost control container and the browser plug-in respectively, and is used to act as an agent for the AxHost control container to interact with the browser plug-in. LinuxAgent is connected to the AxHost control container and the browser plug-in respectively, and is used to act as an agent for the browser plug-in to interact with the AxHost control container.

[0011] A method for running an ActiveX control in a Linux system environment, using the above-mentioned system for running an ActiveX control in a Linux system environment to run an ActiveX control in a Linux system environment, comprises the following steps:

[0012] Step 1, create and initialize the ActiveX control;

[0013] Step 2: Display the ActiveX control information in the browser and activate the ActiveX control;

[0014] Step 3: The browser indirectly accesses the properties and methods of the ActiveX control through the interactive proxy middleware;

[0015] Step 4: The browser receives the event information sent by the ActiveX control through the interactive proxy middleware and processes the events of the ActiveX control.

[0016] Preferably, in step 1, the method for creating and initializing the ActiveX control is:

[0017] Create a browser plug-in in the browser, and obtain the control information of the ActiveX control through the browser plug-in;

[0018] The interactive proxy middleware creates an AxHost control container, which receives control information of the ActiveX control through the interactive proxy middleware, creates an ActiveX control according to the control information, and initializes the created ActiveX control.

[0019] Preferably, in step 2, in the control usage module, the ActiveX control information is displayed by:

[0020] The browser plug-in uses the interactive proxy middleware to query and obtain the corresponding ActiveX control form handle;

[0021] The browser plug-in calls the SVC control;

[0022] The SVC control uses the ActiveX control form handle to display the ActiveX control information in the browser.

[0023] Preferably, in step 2, in the control running module, the ActiveX control is displayed and activated by:

[0024] The AxHost control container calls the SetClientSite method to specify the display area of ​​the ActiveX control in the AxHost control container;

[0025] The ActiveX control calls the Invoke method of the AxHost control container to obtain the Ambient property of the AxHost control container and responds according to the state of the AxHost control container;

[0026] The AxHost control container calls the SetObjectRects method of the ActiveX control to specify the visible area of ​​the ActiveX control when the scene is activated;

[0027] The AxHost control container calls the DoVerb method of the ActiveX control to perform the on-site activation action;

[0028] The ActiveX control calls the CanlnPlaceActivate method of the AxHost control container to ask whether it can be activated on the spot;

[0029] The ActiveX control calls the OnlnPlaceActivate method of the AxHost control container to notify the AxHost control container that it will be activated on-site;

[0030] The ActiveX control calls the GetWindow method of the AxHost control container to obtain the window handle used for display and field activation;

[0031] The ActiveX control calls the GetWindowContext method of the AxHost control container to obtain the position of the window used for display and field activation in the parent window;

[0032] The ActiveX control calls the ShowObject method of the AxHost control container to make sure the container is visible.

[0033] Preferably, in step 3, when accessing the properties and methods of the ActiveX control, the control uses the browser plug-in of the module to implement the relevant interface defined by the JavaScript script support framework of the browser, obtains the operation behavior of the JavaScript script acting on the ActiveX control, and indirectly accesses the properties and methods of the ActiveX control through the interactive proxy middleware.

[0034] Preferably, in step 3, when accessing the properties and methods of the ActiveX control, the ActiveX container of the control execution module receives the message from the interactive proxy middleware to access the properties and methods of the ActiveX control, and parses the properties or method parameters in the data carried in the message into a Variant data type; accesses the properties and methods of the ActiveX control through the IDispatch interface, obtains the DISPID corresponding to the property name or method name of the ActiveX control using the GetIDsOfNames method of the IDispatch interface, and then calls the Invoke method with the DISPID as a parameter to access the properties and methods of the ActiveX control.

[0035] Preferably, in step 4, the AxHost control container of the control execution module captures the ActiveX control event by:

[0036] The AxHost control container creates a receiver for the COM event interface and captures ActiveX control events through the AxHost control container;

[0037] When an ActiveX control event occurs, in the event response function of the AxHost control container, the ActiveX control method is used to obtain the event name corresponding to the event DISPID and send it to the interactive proxy middleware to notify the browser plug-in to process it.

[0038] Preferably, in step 4, the browser plug-in of the control usage module receives and processes the ActiveX control event information by:

[0039] The interactive proxy middleware sends events to the browser plug-in: the interactive proxy middleware uses the inter-process communication mechanism provided by the control usage module to complete the communication with the browser plug-in, and the inter-process communication mechanism uses the message queue method;

[0040] The browser plug-in sends events to JavaScript: When the browser plug-in receives an ActiveX control event passed by the interactive proxy middleware, it queries the event association table by event name, retrieves the corresponding event handler, and passes the event handler and its required parameters to JavaScript for processing by calling the invoke method provided by the browser.

[0041] It can be seen from the above technical solutions that the present invention provides a method and system for running ActiveX controls in a Linux system environment, which has the following beneficial effects compared with the prior art:

[0042] The present invention adds an AxHost control container that supports the running of ActiveX controls in a control running module, adds a browser plug-in that is responsible for reading and displaying ActiveX controls in a control using module, coordinates the control using module and the control running module through an interactive proxy middleware, and finally enables the user to reflect the behavior of operating the ActiveX controls in real time in the browser of the control using module, thereby solving the problem that the control using module under the Linux system cannot support ActiveX controls.

[0043] The present invention performs cross-system interaction based on interactive proxy middleware. The display and on-site activation of ActiveX controls are performed through the interaction between the interactive proxy middleware and the AxHost control container, while the browser and the browser plug-in interact using NPAPI; in addition, the ActiveX control use module and the ActiveX control operation module also belong to different computing units, so the present invention provides a mechanism for the browser and the ActiveX control to interact with each other. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0045] Figure 1 It is a schematic diagram of the overall principle of the present invention;

[0046] Figure 2 A flow chart of the modules used by the control of the present invention;

[0047] Figure 3 It is a flow chart of the control module operation of the present invention;

[0048] Figure 4 Schematic diagram of the process of displaying and activating ActiveX controls for the AxHost control container;

[0049] Figure 5 A schematic diagram of the browser indirectly accessing the properties and methods of ActiveX controls through the interactive proxy middleware;

[0050] Figure 6 Schematic diagram for browser to call browser plug-in method;

[0051] Figure 7 Schematic diagram for capturing ActiveX control events for the AxHost control container;

[0052] Figure 8 A schematic diagram of the process of connecting a Sink object to a Connectable object of an ActiveX control;

[0053] Fig. 9 Schematic diagram of the process of capturing ActiveX control events for the AxHost control container;

[0054] Fig.10 A schematic diagram of a method for sending events to a browser plug-in from an interactive proxy middleware;

[0055] Fig.11 A schematic diagram of the interaction between the browser plug-in using the interactive proxy middleware and the control module;

[0056] Fig.12 A schematic diagram of the interaction between the AxHost control container of the interactive proxy middleware and the control running module;

[0057] Fig.13 Schematic diagram of the working principle of the interactive proxy middleware. DETAILED DESCRIPTION

[0058] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0059] The embodiment of the present invention discloses a method for running an ActiveX control in a Linux system environment. Figure 1-Figure 3 , involving a control usage module, an interactive proxy middleware, and a control operation module connected in sequence, specifically including the following steps:

[0060] Step 1. Create and initialize the ActiveX control.

[0061] (1) Interaction between the control usage module and the interactive proxy middleware:

[0062] To create an ActiveX control object, you need to specify its CLSID (ClassIdentity class identifier). CLSID is a 128-bit integer that identifies the ActiveX control on the Windows operating system. Initialization refers to assigning values ​​to control properties after the control object is created.

[0063] Get the control information of ActiveX control object from browser plug-in: Use <object>or <embed> The attributes of the tag pass the control information to the ActiveX plug-in. The browser parses it into <object>or <embed> When the tag is opened, the standard interface NPP_New is called to create a browser plug-in instance. <embed> The names, values, and total number of attributes of all the tag attributes are stored in the outgoing parameters argn, argv, and argc, respectively. Through the parameters argn, argv, and argc, the browser plug-in instance can obtain the information of the ActiveX control object.

[0064] In the embodiment of the present invention, the browser refers to a browser using the NPAPI 1.0 framework, such as a Firefox browser or other browsers supporting the NPAPI 1.0 framework, which can use the technical solution of the present invention to run ActiveX controls across system environments.

[0065] Once the browser plug-in is obtained <object>or <embed> The information provided by the tag can be used to create an ActiveX control object through the interactive proxy middleware. The ActiveX control object is created immediately after the browser plug-in instance is created and is destroyed before the browser plug-in instance is destroyed.

[0066] (2) Interaction between the control running module and the interactive proxy middleware:

[0067] The interactive proxy middleware creates an AxHost control container, and uses window message communication to pass the CLSID and related initialization parameters required to create an ActiveX control object to the AxHost control container. The AxHost control container uses the COM library function CoCreateInstance to create an ActiveX control object, and uses the IPropertyBag interface provided by the COM library to complete the initialization of the ActiveX control.

[0068] Step 2: Display the ActiveX control information in the browser and activate the ActiveX control.

[0069] (1) In the control usage module, display the ActiveX control information:

[0070] The graphical interface of the ActiveX control runs in the control running module, and the control usage module needs to use the SVC control to display its graphical interface and interact with it. The SVC control is developed based on QT, and its window interface can be displayed in the control usage module by binding the ActiveX control form handle.

[0071] First, obtain the form handle of the ActiveX control corresponding to the browser plug-in: the interactive proxy middleware maintains the correspondence between the browser plug-in and the ActiveX control; the browser plug-in can use the interactive proxy middleware to query and obtain the form handle of its corresponding ActiveX control.

[0072] Secondly, display the graphical interface of the ActiveX control in the browser: Use the SVC control to display the graphical interface of the ActiveX control in the browser. The browser creates a working window of the browser plug-in and uses the SVC control to display the graphical interface of the ActiveX control in it.

[0073] The browser plug-in will get the working window handle when the browser calls the NPP_SetWindow method. The SVC control needs to use it to display the graphical interface of the ActiveX control in the browser. The browser plug-in is responsible for calling the SVC control. It should be noted that the browser plug-in cannot directly call the SVC control developed by QT, but needs to implement a QT application that contains the SVC control and use the SVC control indirectly through it.

[0074] (2) In the control running module, display and activate the ActiveX control:

[0075] AxHost must implement the interfaces shown in Table 1 according to OLE2.0:

[0076] Table 1 Interface and description

[0077]

[0078] The ActiveX control calls the method of the AxHost control container interface when appropriate to complete the interaction with the AxHost control container.

[0079] The methods included in the IDisPatch interface are shown in Table 2 below:

[0080] Table 2 Methods and functions of IDisPatch interface

[0081]

[0082] In the specific implementation, the first three methods of the IDisPatch interface only return E_NOTIMPL, indicating that the functions provided by the method are not implemented. This is because these three methods are not used in the display and field activation process of the ActiveX control. The ActiveX control uses the Invoke method of the IDisPatch interface to obtain the Ambient property of the AxHost. The Ambient property is managed and provided by the AxHost control container. Usually, the Ambient property represents a certain state of the AxHost control container. The AxHost control container notifies the ActiveX control of its own characteristics through the AxHost property, so that the ActiveX control can "sense" the environment around it and respond appropriately. The Ambient properties used by the AxHost control container are shown in Table 3 below:

[0083] Table 3 Ambient attribute names and descriptions

[0084]

[0085] In the present invention, the browser only runs the ActiveX control instead of using the ActiveX control for development, so the DISPID_AMBIENT_USERMODE property of the container is set to TRUE to notify the ActiveX control that it is in the running mode, and the control will be displayed according to the running mode of the container.

[0086] The methods included in the IOleWindow interface are shown in Table 4 below:

[0087] Table 4IOleWindow interface methods and functions

[0088]

[0089] AxHost uses the GetWindow method of the IOleWindow interface to specify the window used by the ActiveX control for display and field activation. The specific implementation is to save the window handle of the AxHost and then return this handle in the GetWindow method. The ContextSensitiveHelp method only returns S_OK, indicating a normal return.

[0090] The methods included in IOleClientSite are shown in Table 5 below:

[0091] Table 5 IOleClientSite interface methods and functions

[0092]

[0093] The AxHost control container only implements the GetContainer method, which returns a pointer to the AxHost container object.

[0094] The methods and implementation order of the IOlelnPlaceSite interface are shown in Table 6 below:

[0095] Table 6 IOLelnPlaceSite interface methods and sequences

[0096]

[0097] AxHost mainly implements the GetWindowContext and OnPosRectChange methods of the IolelnPlaceSite interface. The key to implementing the GetWindowContext method is to pass an IOleInPlaceFrame interface pointer and a pointer to an OLEINPLACEFRAMEINFO structure to the corresponding outgoing parameters of the method. The OLEINPLACEFRAMEINFO structure provides shortcut key information for operating the control interface.

[0098] The OnPosRectChange method must use the SetObjectRects method of the ActiveX control's IOLelnPlaceObject interface to specify which parts of the ActiveX control are visible when it is in the field.

[0099] The AxHost control container simply inherits the IolelnPlaceSiteEx interface and the IOleControlSite interface, and the implementation of its methods simply returns an HRESULT value. Although it does not implement any specific functions, its implementation is necessary. The ActiveX control object must perform the next step based on the HRESULT value returned by the calling method.

[0100] See also Figure 4 , the process of AxHost displaying and activating ActiveX controls is:

[0101] Step 1> The AxHost control container calls the SetClientSite method to specify the display area of ​​the ActiveX control in the AxHost control container;

[0102] Step 2> The ActiveX control calls the Invoke method of the AxHost control container to obtain the Ambient property of the AxHost control container and responds according to the state of the AxHost control container;

[0103] Step 3> The AxHost control container calls the SetObjectRects method of the ActiveX control to specify the visible area of ​​the ActiveX control when it is activated in the field;

[0104] Step 4> The AxHost control container calls the DoVerb method of the ActiveX control to perform the on-site activation action;

[0105] Step 5> The ActiveX control calls the CanlnPlaceActivate method of the AxHost control container to ask whether it can be activated on site;

[0106] Step 6> The ActiveX control calls the OnlnPlaceActivate method of the AxHost control container to notify the AxHost control container that it will be activated on-site;

[0107] Step 7> The ActiveX control calls the GetWindow method of the AxHost control container to obtain the window handle used for display and field activation;

[0108] Step 8> The ActiveX control calls the GetWindowContext method of the AxHost control container to obtain the position of the window used for display and field activation in the parent window;

[0109] Step 9>The ActiveX control calls the ShowObject method of the AxHost control container to make sure the container is visible.

[0110] Step 3: The browser indirectly accesses the properties and methods of the ActiveX control through the interactive proxy middleware.

[0111] (1) Interaction between the control usage module and the interactive proxy middleware:

[0112] 1) Basic principles

[0113] In the IE browser on the Windows platform, the ActiveX control is directly loaded by the browser, so the JavaScript script can access its properties and methods to complete user-defined operations. However, the ActiveX control and the browser belong to different computing units. User operations to access the properties and methods of the ActiveX control require the cooperation of the browser plug-in and the interactive proxy middleware. The browser plug-in implements the relevant interfaces defined by the browser's JavaScript script support framework, obtains the operation behavior of the JavaScript script on the ActiveX control, and indirectly accesses the properties and methods of the ActiveX control through the interactive proxy middleware. The principle is as follows: Figure 5 shown.

[0114] 2) Browser script support framework

[0115] In order for the browser plug-in to acquire the ability to interact with the Javascript scripting language, the implementation of the browser plug-in must comply with the specifications defined by the browser's JavaScript scripting support framework. When the browser loads the browser plug-in, it calls the browser plug-in's NPP_GetValue method to obtain some plug-in information.

[0116] The browser will pass in NPPVpluginScriptableNPObject (variable parameter) to query whether the browser plug-in supports the Scriptable function (i.e. the function of interacting with the scripting language). Here, the browser plug-in can use the NPN_CreateObeject method to create an NPObject object and return it to the browser as a value. In this way, the browser establishes a connection with the browser plug-in through this NPObject object. When the Javascript on the page calls a method of the browser plug-in object, the browser will call the HasMethod method of the NPObject object to query whether this method is supported. If it is supported, the Invoke method of the NPObject object will be called, and the method name, parameters and other information will be passed in. The principle is as follows: Figure 6 shown.

[0117] The browser notifies the browser plug-in of the script operation behavior through the NPObject object. The browser plug-in needs to define the NPClass object to respond to the script operation behavior when calling the NPN_CreateObeject method to construct the NPObject object.

[0118] 3) Data type conversion

[0119] As mentioned above, JavaScript access to the properties and methods of ActiveX controls goes through different stages, from JavaScript initiation to browser plug-in forwarding, and then to the processing of ActiveX controls via the interactive proxy middleware. In this process, the NPVariant data type used by the control module browser plug-in and the Variant data type used by the control running module ActiveX control need to be converted to each other using the interactive proxy middleware. The specific conversion process is that the browser plug-in identifies the specific data type represented by the NPVariant data type object, and serializes the specific data type information and the data it carries into a byte stream, which is passed to the peer end through the interactive proxy middleware. The peer end parses the byte stream and constructs the corresponding Variant data type object for use by the ActiveX control; and vice versa.

[0120] (2) Interaction between the control running module and the interactive proxy middleware:

[0121] 1) IDispatch interface

[0122] ActiveX controls that can run in a browser need to implement the IDispatch interface to expose their properties and methods for access by scripting languages ​​on the web page. ActiveX controls need to implement the four methods defined in the Dispatch interface to provide AxHost with method / property name query and call services, as shown in Table 7 below:

[0123] Table 7 Methods and functions defined by the Dispatch interface

[0124]

[0125] AxHost only uses the GetIDsOfNames and Invoke methods of the IDispatch interface. Through these two methods, AxHost can call all the properties and methods in the ActiveX control.

[0126] 2) The process of accessing the properties and methods of ActiveX controls

[0127] When accessing the properties and methods of an ActiveX control, the ActiveX container of the control runtime module receives messages from the interactive proxy middleware to access the properties and methods of the ActiveX control, and parses the properties or method parameters in the data carried in the message into a Variant data type; the properties and methods of the ActiveX control are accessed through the IDispatch interface, and the GetIDsOfNames method of the IDispatch interface is used to obtain the DISPID corresponding to the property name or method name of the ActiveX control, and then the Invoke method is called with the DISPID as a parameter to access the properties and methods of the ActiveX control.

[0128] Step 4: The browser receives the event information sent by the ActiveX control through the interactive proxy middleware and processes the events of the ActiveX control.

[0129] (1) The AxHost control container of the control runtime module captures ActiveX control events:

[0130] 1) The principle of capturing ActiveX control events

[0131] The principle of AxHost control container capturing ActiveX control events is as follows Figure 7 It uses the Sink object to receive the DISPID of the event sent by the ActiveX control, and searches for the corresponding event name in the type library of the ActiveX control to complete the event capture.

[0132] ActiveX controls provide event services to the outside world through Connectable objects. AxHost must implement Sink objects and connect the Sink objects to the Connectable objects of ActiveX controls. The basic connection process is as follows: Figure 8 As shown. In this way, the AxHost control container can receive events sent by the ActiveX control.

[0133] The AxHost control container completes the "connection" between the Sink object and the ActiveX control object by passing the interface pointer of the Sink object to the ActiveX control object. The ActiveX control object will save the interface pointer and use it to call the method provided by the sink object when appropriate.

[0134] 2) Specific implementation process

[0135] The COM component event framework requires that the object that is "connected" to the ActiveX control for events implement the IDispatch interface so that the object can be notified when an event occurs. Therefore, the Sink object needs to implement the IDispatch interface. When an ActiveX control event occurs, it will call the invoke method of the IDispatch interface to notify the Sink object to respond to the event.

[0136] In order to "connect" the Sink object with the events of the ActiveX control, first, obtain the Connectable object GUID of the ActiveX control through the ITypeInfo interface of the ActiveX control. The Connectable object contains the events supported by the ActiveX control; then, use the GUID as a parameter, use the FindConnectionPoint method to obtain the Connectable object, and call its Advise method to "connect" the Sink object with the ActiveX control.

[0137] After the Sink object establishes a "connection" with the ActiveX control event, when an ActiveX control event occurs, the GetNames method of the ITypeInfo interface of the ActiveX control is used in the Sink object event response function to obtain the event name corresponding to the event DISPID and send it to the interactive proxy middleware to notify the browser plug-in to process it. Fig. 9 shown.

[0138] (2) The browser plug-in of the control usage module receives and processes the ActiveX control event information:

[0139] 1) The interactive proxy middleware sends events to the browser plug-in

[0140] Because the interactive proxy middleware and the browser plug-in belong to different processes, the interactive proxy middleware cannot communicate directly with the browser plug-in. It needs to use a certain inter-process communication mechanism provided by the control usage module to complete the communication with the browser plug-in.

[0141] The present invention selects the "message queue" as an inter-process communication method, which requires the browser plug-in to create a thread, and create a message queue in the thread and wait to receive messages from the interactive proxy middleware. The browser plug-in ID is used as the name of the message queue. In this way, when the interactive proxy middleware receives an ActiveX control event, it can obtain the message queue according to the browser plug-in ID, put the event and event-related parameters as a message into the message queue to notify the browser plug-in to process. Fig.10 shown.

[0142] 2) Browser plugin sends events to JavaScript

[0143] Since the browser will parse <object>or <embed> The tag creates a browser plug-in instance. During the browser's parsing process, the browser will also <object>or <embed> The attributes of the tag are passed to the browser plug-in instance. The browser plug-in will define the event association table. <object>or <embed> The event name and event handler in the tag are saved. Therefore, when the browser plug-in instance receives the event name and event-related parameters passed by the interactive proxy middleware, it can query the event association table according to the event name, retrieve the corresponding event handler, and then pass the event handler and its required related parameters to JavaScript for processing by calling the invoke method provided by the browser.

[0144] 3) Solve the problem of rapid event triggering

[0145] The browser plug-in creates the "message queue" and the ActiveX control in parallel. So, when the ActiveX control is created and immediately issues an event, the "message queue" in the thread may not have been created yet, so the browser plug-in loses the processing of this event. The key to solving the problem of fast event triggering is to ensure that the thread's "message queue" is created before the ActiveX control object is established; this can be achieved by using the thread synchronization method during the creation of the browser plug-in. The specific process is to set the synchronization event when the browser plug-in is instantiated, create a thread, and wait for the synchronization event to be triggered after the thread completes the creation of the "message queue". After receiving the synchronization event, the browser plug-in continues to create the ActiveX control object.

[0146] The embodiment of the present invention also provides a system for running ActiveX controls in a Linux system environment, including a control using module based on a Linux system, a control running module based on a Windows system, and an interactive proxy middleware.

[0147] (1) The control usage module includes a browser and a browser plug-in, which constitute the usage environment of the ActiveX control. The browser is connected to the interactive proxy middleware through the browser plug-in. The interactive proxy middleware interacts with the browser plug-in of the control usage module, such as Fig.11 As shown, after being called by the browser, the browser plug-in creates and initializes the ActiveX control through the interactive proxy middleware, and associates the working window assigned by the browser with the ActiveX window provided by the interactive proxy middleware, completing the display and on-site activation of the ActiveX control in the browser. The browser plug-in also implements access to the properties and methods of the ActiveX control, allowing JavaScript to indirectly access the ActiveX control through these methods. In addition, it can capture events triggered by the ActiveX control and send notifications in a custom format to the browser, which JavaScript uses to complete the processing of the event.

[0148] (2) The control running module includes an AxHost control container and an ActiveX control, which constitute the running environment of the ActiveX control. The ActiveX control is connected to the interactive proxy middleware through the AxHost control container. The interactive proxy middleware interacts with the AxHost control container of the control running module, such as Fig.12 As shown in the figure, the interactive proxy middleware creates an AxHost control container, and the AxHost control container loads and executes the ActiveX control. The AxHost control container is responsible for displaying the ActiveX control interface and adjusting the size of the ActiveX control as needed. The AxHost control container is also responsible for accessing the properties and methods of the ActiveX control, so that the interactive proxy middleware can indirectly access the ActiveX control through it. In addition, it can capture events triggered by the ActiveX control and notify the interactive proxy middleware, and the control usage module completes the processing of the event.

[0149] (3) Interactive Proxy Middleware

[0150] like Fig.13 As shown, the interactive agent middleware consists of the control usage module agent WindowsAgent and the control running module agent LinuxAgent: WindowsAgent is deployed in the control usage module, provides services for the AxHost control container of the control running module, and acts as an agent for its interaction with the browser plug-in of the control usage module; LinuxAgent is deployed in the control running module, provides services for the browser plug-in of the control usage module, and acts as an agent for its interaction with the AxHost control container of the control running module.

[0151] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0152] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.< / object> < / object> < / object> < / object> < / object> < / object>

Claims

1. A system for running ActiveX controls in a Linux system environment, characterized in that: Including Linux-based control usage module, Windows-based control operation module, and interactive agent middleware; The control usage module includes a browser and a browser plug-in, which constitute the usage environment of the ActiveX control. The browser is connected to the interactive proxy middleware through the browser plug-in. The browser is a browser using the NPAPI 1.0 framework. The control running module includes an AxHost control container and an ActiveX control, which constitute the running environment of the ActiveX control. The ActiveX control is connected to the interactive proxy middleware through the AxHost control container. The interactive proxy middleware includes a control usage module proxy WindowsAgent deployed in the control usage module and a control running module proxy LinuxAgent deployed in the control running module. WindowsAgent is connected to the AxHost control container and the browser plug-in respectively, and is used to act as an agent for the AxHost control container to interact with the browser plug-in. LinuxAgent is connected to the AxHost control container and the browser plug-in respectively, and is used to act as an agent for the browser plug-in to interact with the AxHost control container.

2. A method for running an ActiveX control in a Linux system environment, using the system for running an ActiveX control in a Linux system environment as claimed in claim 1, characterized in that: The following steps are involved: Step 1, create and initialize the ActiveX control; Step 2: Display the ActiveX control information in the browser and activate the ActiveX control; Step 3: The browser indirectly accesses the properties and methods of the ActiveX control through the interactive proxy middleware; Step 4: The browser receives the event information sent by the ActiveX control through the interactive proxy middleware and processes the events of the ActiveX control.

3. A method for running an ActiveX control in a Linux system environment according to claim 2, characterized in that: In step 1, the method for creating and initializing the ActiveX control is: Create a browser plug-in in the browser, and obtain the control information of the ActiveX control through the browser plug-in; The interactive proxy middleware creates an AxHost control container, which receives control information of the ActiveX control through the interactive proxy middleware, creates an ActiveX control according to the control information, and initializes the created ActiveX control.

4. A method for running an ActiveX control in a Linux system environment according to claim 3, characterized in that: In step 2, in the control usage module, the ActiveX control information is displayed by: The browser plug-in uses the interactive proxy middleware to query and obtain the corresponding ActiveX control form handle; The browser plug-in calls the SVC control; The SVC control uses the ActiveX control form handle to display the ActiveX control information in the browser.

5. A method for running an ActiveX control in a Linux system environment according to claim 4, characterized in that: In step 2, in the control running module, the ActiveX control is displayed and activated by: The AxHost control container calls the SetClientSite method to specify the display area of ​​the ActiveX control in the AxHost control container; The ActiveX control calls the Invoke method of the AxHost control container to obtain the Ambient property of the AxHost control container and responds according to the state of the AxHost control container; The AxHost control container calls the SetObjectRects method of the ActiveX control to specify the visible area of ​​the ActiveX control when the scene is activated; The AxHost control container calls the DoVerb method of the ActiveX control to perform the on-site activation action; The ActiveX control calls the CanlnPlaceActivate method of the AxHost control container to ask whether it can be activated on the spot; The ActiveX control calls the OnlnPlaceActivate method of the AxHost control container to notify the AxHost control container that it will be activated on-site; The ActiveX control calls the GetWindow method of the AxHost control container to obtain the window handle used for display and field activation; The ActiveX control calls the GetWindowContext method of the AxHost control container to obtain the position of the window used for display and field activation in the parent window; The ActiveX control calls the ShowObject method of the AxHost control container to make sure the container is visible.

6. A method for running an ActiveX control in a Linux system environment according to claim 3, characterized in that: In step 3, when accessing the properties and methods of the ActiveX control, the control uses the browser plug-in of the module to implement the relevant interface defined by the browser's JavaScript script support framework, obtains the operation behavior of the JavaScript script on the ActiveX control, and indirectly accesses the properties and methods of the ActiveX control through the interactive proxy middleware.

7. A method for running an ActiveX control in a Linux system environment according to claim 6, characterized in that: In the step 3, when accessing the properties and methods of the ActiveX control, the ActiveX container of the control running module receives the message from the interactive proxy middleware to access the properties and methods of the ActiveX control, and parses the properties or method parameters in the data carried by the message into a Variant data type; accesses the properties and methods of the ActiveX control through the IDispatch interface, obtains the DISPID corresponding to the property name or method name of the ActiveX control by using the GetIDsOfNames method of the IDispatch interface, and then calls the Invoke method with the DISPID as a parameter to access the properties and methods of the ActiveX control.

8. A method for running an ActiveX control in a Linux system environment according to claim 7, characterized in that: In step 4, the AxHost control container of the control execution module captures the ActiveX control event by: The AxHost control container creates a receiver for the COM event interface and captures ActiveX control events through the AxHost control container; When an ActiveX control event occurs, in the event response function of the AxHost control container, the ActiveX control method is used to obtain the event name corresponding to the event DISPID and send it to the interactive proxy middleware to notify the browser plug-in to process it.

9. A method for running an ActiveX control in a Linux system environment according to claim 8, characterized in that: In step 4, the browser plug-in of the control usage module receives and processes the ActiveX control event information in the following manner: The interactive proxy middleware sends events to the browser plug-in: the interactive proxy middleware uses the inter-process communication mechanism provided by the control usage module to complete the communication with the browser plug-in, and the inter-process communication mechanism uses the message queue method; The browser plug-in sends events to JavaScript: When the browser plug-in receives an ActiveX control event passed by the interactive proxy middleware, it queries the event association table by event name, retrieves the corresponding event handler, and passes the event handler and its required parameters to JavaScript for processing by calling the invoke method provided by the browser.

Citation Information

Cited By

  • Safe NPAPI plug-in browser loading method and device

    CN122508601A