Active|activex| Interaction | Control tornado
Keywords: Asp,activex controls, digital signatures, security
Let's take a look at how to get the data from the server and pass it to the ActiveX control.
1) using parameter binding when initializing
2 run time to get data
Open VB6 To create a new ActiveX control project.
Project name: focx, User control name: UC2
For convenience, we use the ActiveX Control Interface Wizard ..., menu-> add-in-> add-in Manager->vb 6 ActiveX Control Interface Wizard. sure you can.
Open the ActiveX Control Interface Wizard, and next, for the available names and selected names, we default next, create a new custom member, GetInfo type: Properties, next, a common method to select the GetInfo we just added, map to the control selection Txtinfo, the member select text, The next step is done. The code window will generate some we don't need, delete,
Attention Do not delete or modify the following commented lines!
' Mappinginfo=txtinfo,txtinfo,-1,text
Public Property Get GetInfo () as String
GetInfo = Txtinfo. Text
End Property
Public Property Let GetInfo (ByVal New_getinfo as String)
Txtinfo. Text () = New_getinfo
PropertyChanged "GetInfo"
End Property
Private Sub Command1_Click ()
Label2.Caption = GetInfo ()
End Sub
' Load the property value from the memory
Private Sub usercontrol_readproperties (propbag as PropertyBag)
Txtinfo. Text = Propbag.readproperty ("GetInfo", "Text1")
End Sub
' Write attribute values to storage
Private Sub usercontrol_writeproperties (propbag as PropertyBag)
Call Propbag.writeproperty ("GetInfo", Txtinfo. Text, "Text1")
End Sub
Compiled into an OCX control. Run the generated test page. The default in text is Text1
How do I pass the server-side data to OCX?
This tool is easy to find with Microsoft ActiveX Control pad.
Use this tool to open the test page directly.
Menu->edit->edit Activex control, hehe, opens a visual interface.
See, there is a property box that we can set up and set to complete after the following code:
<HTML>
<HEAD>
<title>new page</title>
</HEAD>
<BODY>
<object id= "Getclient" width=507 height=440
Classid= "CLSID:890D1028-298B-45CF-9A64-6ED5A5BACBC9"
codebase= "Http://localhost/xml/fOcx.ocx" >
<param name= "_extentx" value= "13414" >
<param name= "_extenty" value= "11642" >
<param name= "GetInfo" value= "This is OCX the client card reader Information" >
</OBJECT>
</BODY>
</HTML>
Added Id,id is the flag we use to access. And our property GetInfo, we also set the initial value.
Okay, run.
Text in the value of our set "This is OCX the client card reader information."
We change the top page to ASP, look at the code:
<HTML>
<HEAD>
<TITLE> Tornado test Page </TITLE>
</HEAD>
<BODY>
<%
Dim svalue
Svalue= "This is the information from the client card reader of OCX."
%>
<object id= "Getclient" width=507 height=440
Classid= "CLSID:56DFCA88-F5B8-4879-853B-97FE504423FD"
codebase= "Http://localhost/xml/fOcx.ocx" >
<param name= "_extentx" value= "13414" >
<param name= "_extenty" value= "11642" >
<param name= "GetInfo" value= "<%=sValue%>" >
</OBJECT>
</BODY>
</HTML>
OK, run it
Let's look at the second situation.
Get data at run time
<HTML>
<HEAD>
<TITLE> Tornado test Page </TITLE>
<%
Dim svalue
Svalue= "This is the information from the client card reader of OCX."
%>
<script Id=clienteventhandlersjs language=javascript>
<!--
function Button1_onclick ()
{
getclient.getinfo= ' <%=sValue%> ';
}
-->
</SCRIPT>
</HEAD>
<BODY>
<object id= "Getclient" width=507 height=440
Classid= "CLSID:56DFCA88-F5B8-4879-853B-97FE504423FD"
codebase= "Http://localhost/xml/fOcx.ocx" >
<param name= "_extentx" value= "13414" >
<param name= "_extenty" value= "11642" >
</OBJECT>
<input id=button1 Type=button Value=button name=button1 language=javascript onclick= "Return butt