ActiveX controls are automatically downloaded in IE browser

Source: Internet
Author: User
Tags win32

----------------------------------------------------------------------

1. Use MFC ActiveX ControlWizard to develop an ActiveX (. ocx) control for Web pages that I want to download and install automatically when the browser browses to the meeting. (Prompts the user to download the installation), the page code is as follows:
<object id= "MYPDA" width= "100%" height= "" classid= "CLSID:567A193A-7D14-4EF3-912E-7396ECC2BBC3" codebase= " Mypda.ocx "viewastext>
</OBJECT>
But you can't download the control, why?
2, ATL COM AppWizard development of the control can be run on the IE client. (I will only develop running on the IIS server, do not know how to make it run on the client) if yes, how to develop (principle)


----------------------------------------------------------------------

Codebase= "Mypda.ocx"
Should be a specific file address to be stored in a CAB package, add a signature to the package. and add the version

such as codebase= "http://www.xxx.com/MyPDA.cab#version=2,0,0,30"

--------------------------------------------------------

How to make the control into cab in VC

--------------------------------------------------------

Can a control developed by ATL COM AppWizard run on the IE client?

--------------------------------------------------------

1, if you need to create a CAB file, first need Cabarc or MakeCab, they are installed with the Cabinet SDK, Cabinet SDK download address is http://msdn.microsoft.com/workshop/ Management/cab/cabdl.asp.
Cabarc can create, view, or unpack files inside the cab, while MakeCab can only be used to create CAB files.
2, the production of the CAB file needs to be all the relevant files are included in, you can check the required files through depends (VC comes with). Use the INF file to write these things in.
3. inf pointers: INF file describes all the OCX and DLL files in the CAB, and the INF provides the required information through some named zones.

How to write INF
The first is generally the [Version] area:
eg: [Version]
Signature= "$XXXX $"
advancedinf=2.0
Next is the most important [Add.Code] zone:
eg: [Add.Code]
Ctrl1.dll=c1section
Ctrl2.dll=ctrl2.dll
The first is the file name to download, followed by the name of the region corresponding to the file, can be any name, but is generally the same name as the file, so as to facilitate maintenance. It is also important to note that the files that appear in the [Add.Code] zone are sorted according to dependencies, such as the previous ctrl1.dll to rely on Ctrl2.dll, Ctrl2.dll to appear in front of Ctrl1.dll. Because the installation is in reverse order, that is to install Ctrl2.dll first, then Ctrl1.dll, began popping began popping, remember clearly, do not make the reverse.
And then there's the area for each file.
[Ctrl1.dll]
File-win32-x86=thiscab
Registerserver=yes
Clsid={...}
Destdir=
fileversion=1,0,0,0
The first file value in the [Ctrl1.dll] area tells IE where to get the dll,file altogether consists of three parts, the first part is file, this is always the case (at least for now); The second part tells the statement that the supported Os,win32 represents Windows, Mac is Apple Mac Ox, and the third part is CPU type, such as x86, PPC (Power PC), MIPS or Alpha.
The value of file can take three URLs, ignore and thiscab, if the URL is the location of the URL to go down, if it is ignore instructions for this OS and CPU, do not need to download this file (Ctrl1.dll) If it is thiscab it is obvious that it is in the current CAB file.
Next is the RegisterServer, can take two values Yes and no, if yes, ie to register the DLL, if it is no need to;
The next is Destdir, which is the value of the DLL will be saved to the local hard disk location, if its value is 10, then put the DLL to/windows or/WINNT, if it is 11, then put to/windows/system or
/winnt/system32, if it is empty (that is, there is no value) will be placed in the/windows or/winnt under the Downloaded Program Files directory;
Finally, FileVersion, this is more obvious, explains the Ctrl1.dll version number.
Sometimes we use VB to develop the control, we need to install VB virtual machine, it needs some other instructions, simply say it:
Add a msvbvm60.dll=msvbvm60 to [Add.Code]. DLL (Take VB6 as an example) the following is
MSVBVM60. DLL Area:
[MSVBVM60. DLL]
Hook=msvbvm60.cab_installer
fileversion=6,0,81,76
FileVersion is obviously, is the version number, will not say the hair, say the hook.
The hook area is the area that needs to be executed at the time of installation, it is divided into two kinds, one is conditional, the other is unconditional, the unconditional hook area is mandatory, and the other is based on the condition to decide whether to execute. The area marked with [Setup Hooks] is an unconditional region, as shown below
[Setup Hooks]
Hookname=section-name

[Section-name]
Run=%extract_dir%/setup.exe
An unconditional zone is often used to execute an installer through an INF file, which is why we do install such a menu when the resource Manager right-clicks an INF file.
When IE downloaded a CAB file, if there is no [Add.Code] in the file, then process the [Setup Hooks] area, run the program specified by running, began popping began popping, which is setup.exe;
The conditional area is executed under certain conditions, The hook area specified earlier for MSVBVM60.DLL is a conditional area, and the area specified by the hook is executed if the CLSID specified in MSVBVM60.DLL or version does not meet the needs and there is no file named value.
[Msvbvm60.cab_installer]
File-win32-x86=http://activex.microsoft.com/controls/vb6/vbrun60.cab
Run=%extract_dir%/vbrun60.exe
The above [Msvbvm60.cab_installer] is a hook area, it also contains a file value, specifying a URL, indicating that MSVBVM60.DLL can be downloaded from the URL; run shows which file to execute
It is important to note here that MS has some common redistributable Microsoft DLLs
You can specify the CODEBASE property as Http://activex.microsoft.com/controls so that you need to include these files in the CAB file. There is a file on the computer redist.txt the above DLL is redistributable Microsoft DLLs


Create a CAB file:
Cabarc N Ctrl1.cab Ctrl1.inf Ctrl1.dll
n means to create a new file, Ctrl1.cab is the name of the file created, Ctrl1.inf is the inf of the CAB, but the file that needs to be added to the cab, you can use wildcards.
Then you can put the CAB file on the Web page.
<object id= "Ctrl1obj"
Classid= "CLSID: ........................ ..."
codebase= "http://server.com/ctrl1.cab#version=8,0,0,5007" >
</OBJECT>
This is also a version, but here version is the version of the accusation, and the INF is the version of the file.


Make an electronic signature:
First download the signature tool signcode from the URL below, the address is
Http://msdn.microsoft.com/workshop/gallery/tools/authenticode/authcode.asp
Microsoft Certificate running from a signature authorization center such as VeriSign or your local area network
Server Licensing server get a certificate, in the process of requesting authorization you will get a private key.
You can also test with the private key created by MakeCert.exe and Cert2Spc.exe by first using MakeCert to create a certificate (. cer file)
MAKECERT-SV mykey.pvk N "cn=my software company" Mycert.cer
The. cer file is then converted to a PKCS #7软件发布Certificate (. spc file) by using CERT2SPC.
CERT2SPC Mycert.cer MYCERT.SPC
Use your downloaded signcode to electronically sign your CAB file
SIGNCODE-SPC mycert.spc-v mykey.pvk-t/http
Timestamp.verisign.com/scripts/timstamp.dll Ctrl1.cab
Signcode can also specify a number of other parameters, do not say, too long, began popping began popping.
Although you can take advantage of the test. cer and. spc files, you must apply at the time of publication.

--------------------------------------------------------

Can a control developed by ATL COM AppWizard run on the IE client?


--------------------------------------------------------

Mark

--------------------------------------------------------

IE will warn you.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.