必備工具:
 

  • CabArc.Exe
  • Cert2Spc.Exe
  • makecert.exe
  • SetReg.Exe
  • signtool.exe (或者 signcode.exe)
     

以及相關(guān)動態(tài)庫,以上文件可到微軟網(wǎng)站下載:

http://www.microsoft.com/msdownload/platformsdk/sdkupdate/default.htm?p=/msdownload/platformsdk/sdkupdate/SDKInfo.htm
 

安裝 Internet Development SDK 后,
 

第一步 建立一個 .inf 文件,樣式如下:

[version]
?,ignature="$CHICAGO$"
AdvancedINF=2.0
[Add.Code]
time.ocx=time.ocx
msvcrt.dll=msvcrt.dll
?,fc42.dll=mfc42.dll
?,lepro32.dll=olepro32.dll
[time.ocx]
file-win32-x86=thiscab
?,lsid={DCF0768D-BA7A-101A-B57A-0000C0C3ED5F}
?,ileVersion=1,0,0,0
?,?DestDir=11?,,?;***
RegisterServer=yes
[msvcrt.dll]
?,ileVersion=4,20,0,6164
hook=mfc42installer
[mfc42.dll]
?,ileVersion=4,2,0,6256
?,ook=mfc42installer
[olepro32.dll]
?,ileVersion=4,2,0,6068
?,ook=mfc42installer
[mfc42installer]
file-win32-x86=http://activex.microsoft.com/controls/vc/mfc42.cab
?,un=%EXTRACT_DIR%\mfc42.exe

DestDir 可以=10 :Windows 目錄,
?,,,,,?11 :Windows\System(32) 目錄,
?,,,?空 :Occache directory
 

第二步 將 ActiveX 控件及 .inf 文件打包進(jìn) .cab,命令如下:

cabarc.exe -s 6144 N yourActiveX.cab yourActiveX.ocx yourActiveX.inf
 

第三步 給 .cab 文件簽名

1. setreg 1 true
2. makecert newCert.cer -sv privatekey.pvk
?,I?newCert.cer 和 privatekey.pvk 兩個文件
3. Cert2Spc newCert.cer newCert.spc
4. signtool signwizard
有圖形界面的簽名向?qū)?,按提示指定有關(guān)文件路徑即可,其中的描述是控件的描述。