1. How to get data from the server and pass it to ActiveX controls?
1) uses parameter binding when initializing.
2) get data at runtime
2.ActiveX controls get information from the client and how to transmit the information to the server.
3. Security
1) digital signature
2) using IOBJSAFE interface
Ok, let's start learning examples.
This function demonstrates how to make a simple control and embed it in a web page for execution.
Working environment: WINXP+VB6+IE6
My IE security is set to security level-medium. All Activex options are set to enabled.
Open vb6 and create a new ActiveX control project.
Project name: fOcx, user control name: UC 1.
For convenience, we use ActiveX control interface wizard …, menu->; Add-in-> Add-in manager->; VB 6 ActiveX control interface wizard. Just making sure.
Open the ActiveX control interface wizard. Next, for the available names and the selected names, we default to the next step and create a new custom member GetInfo Type: Attribute. Next, * * * has a way to select the GetInfo we just added, map it to the control, select TxtInfo, and select the text for the member. Next, we will finish. The code window will generate something we don't need, delete it, and the rest of the code is as follows:
Option explicit
Attention! Please do not delete or modify the following comment lines!
MappingInfo=txtinfo,txtinfo,- 1,Text
The public property GetInfo () is used as a string.
GetInfo = txtinfo。 text
End attribute
Public property let getinfo (byvalnew _ getinfo as string)
txtinfo。 Text() = New_GetInfo
PropertyChanged GetInfo
End attribute
Load property values from memory.
Private sub user control _ read properties (propbag as PropertyBag)
txtinfo。 Text = PropBag。 ReadProperty(GetInfo,Text 1)
End joint
Writes the attribute value to memory.
Private sub user control _ write properties (propbag as PropertyBag)
Call PropBag. WriteProperty(GetInfo,txtinfo。 Text, Text 1)
End joint
Ok, let's compile it into fOcx.ocx file first, then F5 will run it directly, and VB will open the test page. As follows:
e:\ Program Files \ Microsoft Visual Studio \ VB98 \ UC 1 . html
At the same time, open your IE browser, and look, the control you made appears on this test page.
You can open the test page to see the ClsID, such as: 890d1028-298b-45cf-9A64-6ED5ABBC 9.
Because VB has been registered at compile time, it is impossible to simulate the prompt without installing the control on the client.
We continue to
Use regsvr32f: \ csdn _ VB \ com+_ ActiveX \ sample1\ focx.ocx–u to uninstall.
or
Open the registry and find it under HKEY _ Class _ Root \CLSID.
Item 890d1028-298b-45cf-9a64-6ed5abbc9, deleted. Of course, there are still items that have not been deleted this way.
Because ActiveX in IE is set to start, the control will be displayed.