锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
public
聽(tīng)I(yíng)ObjectSafetyImpl
<
CPolyCtl,聽(tīng)I(yíng)NTERFACESAFE_FOR_UNTRUSTED_CALLER聽(tīng)
|
聽(tīng)I(yíng)NTERFACESAFE_FOR_UNTRUSTED_DATA
>
COM_INTERFACE_ENTRY(IObjectSafety)2.聽(tīng) 杞崲cer鏍煎紡涓簊pc鏍煎紡錛?br />
cert2spc聽(tīng)聽(tīng)聽(tīng)dream.cer聽(tīng)聽(tīng)聽(tīng)dream.spc聽(tīng)聽(tīng)聽(tīng)3.聽(tīng) 緇檆ab鏂囦歡絳懼悕
signtool聽(tīng)signwizard4.聽(tīng) 鍦╳eb欏典笂宓屽鍏ョ鍚嶇殑CAB鏂囦歡
<BODY>
<OBJECT聽(tīng)ID="PolyCtl"聽(tīng)
CLASSID="CLSID:4CBBC676-507F-11D0-B98B-000000000000"
CODEBASE="http://example.sq-soft.com/mydir/myctl.cab#version=1,0,0,1">
</OBJECT>
</BODY>CODEBASE 涔熷彲浠ョ洿鎺ユ寚鍚?OCX 鎴?DLL 鏂囦歡錛?/p>
涓夈佸垱寤篊AB鏂囦歡(鎽樺綍鑷狹SDN錛?/strong>
1.聽(tīng) 鍒涘緩INF鏂囦歡
;聽(tīng)Sample聽(tīng)I(yíng)NF聽(tīng)file聽(tīng)for聽(tīng)POLYGON.DLL
[version]聽(tīng)
;聽(tīng)version聽(tīng)signature聽(tīng)(same聽(tīng)for聽(tīng)both聽(tīng)NT聽(tīng)and聽(tīng)Win95)聽(tīng)do聽(tīng)not聽(tīng)remove
signature="$CHICAGO$"
AdvancedINF=2.0聽(tīng)聽(tīng)
[Add.Code]
polygon.dll=polygon.dll
atl.dll=atl.dll
;聽(tīng)needed聽(tīng)DLL
[atl.dll]
file-win32-x86=thiscab
FileVersion=2,00,0,7024
DestDir=11
RegisterServer=yes聽(tīng)
[polygon.dll]
file-win32-x86=thiscab
clsid=
{4CBBC676-507F-11D0-B98B-000000000000}聽(tīng)
FileVersion=1,0,0,1聽(tīng)
RegisterServer=yes聽(tīng)聽(tīng)
;聽(tīng)end聽(tīng)of聽(tīng)I(yíng)NF聽(tīng)file
file-win32-x86=http://example.microsoft.com/mydir/NEEDED.DLL聽(tīng)鍏抽敭瀛椻渇ile-win32-x86鈥濆皢騫沖彴鏍囪瘑涓?x86 鐗瑰畾鐨勩?/p>
鍙氳繃鍦?Windows 璧勬簮綆$悊鍣ㄤ腑鐨勬枃浠朵笂鍗曞嚮榧犳爣鍙抽敭鏉ヨ幏鍙栨枃浠剁殑鐗堟湰鍙楓備粠鏄劇ず鐨勫垪琛ㄤ腑閫夋嫨鈥滃睘鎬р濓紝鐒跺悗鍦ㄦ樉紺虹殑瀵硅瘽妗嗕腑閫夋嫨鈥滅増鏈濋夐」鍗°傛湁鏃墮渶瑕佸湪鏂囦歡鐗堟湰涓澶栨彃鍏ヤ竴涓?0銆備緥濡傦紝鍦ㄥ璇濇涓?ATL.DLL 鐨勭増鏈彿鏄劇ず涓?2.00.7024銆傝屽湪 INF 鏂囦歡涓紝榪欏彉?shù)?2, 00, 0, 7024銆?/p>
鈥淒estDir鈥濇槸灝嗚鍔犺澆鏂囦歡鐨勭洰褰曟墍鍦ㄧ殑浣嶇疆錛?1 鎸囧畾緋葷粺鐩綍涓?WINDOWS/SYSTEM 鎴?WINNT/SYSTEM32錛?0 鎸囧畾 Windows 鐩綍銆乄INDOWS 鎴?WINNT銆傚鏋滄湭鎸囧畾浠諱綍 DestDir錛堝吀鍨嬫儏鍐碉級(jí)錛屽垯浠g爜瀹夎鍦ㄥ浐瀹氱殑 OCCACHE 鐩綍涓?/p>
鈥渃lsid鈥濇槸灝嗚瀹夎鐨勬帶浠剁殑 CLSID銆?br />
2.聽(tīng) 鍒涘緩CAB鏂囦歡
鍒涘緩浜?INF 鏂囦歡鍚庯紝榪愯 CABARC 瀹炵敤宸ュ叿浠ュ垱寤?CAB 鏂囦歡銆傚簲鍦ㄥ寘鍚簮鏂囦歡鐨勭洰褰曚笅榪愯 CABARC銆傚湪鍛戒護(hù)琛屼笂錛屾寜婧愭枃浠跺嚭鐜板湪 INF 涓殑欏哄簭鎺掑垪瀹冧滑錛屽茍灝?INF 鏂囦歡鏀懼湪鏈鍚庛備緥濡傦細(xì)
搴斿湪鍖呭惈婧愭枃浠訛紙INF銆丱CX 鍜?DLL 鏂囦歡錛夌殑鐩綍涓嬭繍琛?CABARC銆傚皢鍦?CAB 鏂囦歡涓瓨妗g殑鏂囦歡搴旇鎸夊畠浠湪 INF 鏂囦歡涓垪鍑虹殑鍚屼竴欏哄簭鍦ㄥ懡浠よ涓垪鍑恒傚湪涓婇潰鐨勭ず渚嬩腑錛孖NF 鏂囦歡搴旇灝?NEEDED1.DLL 鍒楀湪絎竴浣嶏紝鎺ヤ笅鏉ユ槸 NEEDED2.DLL錛岀劧鍚庢槸 MYCTL.OCX銆?/p>
-s 閫夐」鍦ㄥ帇緙╂枃浠朵腑淇濈暀鐢ㄤ簬浠g爜絳懼悕鐨勭┖闂淬?b>n 鍛戒護(hù)鎸囧畾甯屾湜鍒涘緩 CAB 鏂囦歡銆?br />聽(tīng)
DECLARE_DISPATCH_MAP()
DECLARE_INTERFACE_MAP()
2.聽(tīng) 聽(tīng).cpp鏂囦歡瀹炵幇鎺ュ彛銆佸垎媧綢D鏄犲皠
//
鏄犲皠鍒嗘淳ID
BEGIN_DISPATCH_MAP(cThisClass,聽(tīng)CBaseClass)
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)DISP_FUNCTION_ID(CThisClass,聽(tīng)
銆銆銆銆銆銆銆銆銆銆銆 "
ComFunc
"
,
銆銆銆銆銆銆銆銆銆銆聽(tīng)銆 DISP_ID,聽(tīng)
銆銆銆銆銆銆銆銆銆銆銆聽(tīng)聽(tīng) LocalFuncName,聽(tīng)
銆銆銆銆銆銆銆銆銆銆銆聽(tīng)聽(tīng) VARIANT_RETURN_TYPE,聽(tīng)
銆銆銆銆銆銆銆銆銆銆銆聽(tīng)聽(tīng) VARIANT_PARAMS_TYPE)
END_DISPATCH_MAP()
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)
//
鏄犲皠浜嬩歡鎺ュ彛
BEGIN_INTERFACE_MAP(CThisClass,CBaseClass)聽(tīng)聽(tīng)聽(tīng)聽(tīng)
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)I(yíng)NTERFACE_PART(CThisClass,聽(tīng)DIID_IEventXX,銆Dispatch)聽(tīng)
//
榪欓噷Dispatch涓篊CmdTart綾葷殑涓涓粨鏋?璇ュ畯濉厖榪欎釜緇撴瀯
END_INTERFACE_MAP()
3.聽(tīng) #import "...\緇勪歡鍚?tlb" no_namespace named_guids聽(tīng)no_namespace
4. 鍒濆鍖朇OM搴撱丏ispatch緇撴瀯騫跺緩绔嬭繛鎺?/p>
EnableAutomation(
);聽(tīng)聽(tīng)聽(tīng)聽(tīng)//鍚屼笂闈㈢殑瀹忎竴璧峰疄鐜頒簡(jiǎn)IDispatch鎺ュ彛
5.聽(tīng) 瀹炵幇鏄犲皠鍑芥暟(LocalFuncName)
6.聽(tīng) 鍗歌澆COM搴撱佸彇娑堣繛鎺?/p>
AfxConnectionUnadvise(
)聽(tīng)聽(tīng)聽(tīng)
鏂規(guī)硶浜?聽(tīng) 浣跨敤ATL鏄犲皠瀹忥紝緇ф壙IDsipEventImpl
1.聽(tīng)聽(tīng)聽(tīng)#import "...\緇勪歡鍚?tlb" no_namespace named_guids
2.聽(tīng) 瀹炵幇浜嬩歡鎺ユ敹綾籆EventSink
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)a.聽(tīng)聽(tīng)浣跨敤ATL瀹忓畾涔夊嚱鏁頒俊鎭粨鏋劼?tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)?/p>
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng) b.聽(tīng) 聽(tīng)ATL瀹忔槧灝勪簨浠跺嚱鏁奧犅?tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)?/p>
BEGIN_SINK_MAP(CEventSink)
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)SINK_ENTRY_INFO(
1
,聽(tīng)DIID_I
,聽(tīng)DISP_ID,聽(tīng)LocalFunc,聽(tīng)
&
FuncINfo)
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)
END_SINK_MAP()
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)#ifndef聽(tīng)__EVENTSINK_H
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)#define聽(tīng)__EVENTSINK_H
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)namespace聽(tīng)
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)
{
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)static聽(tīng)const聽(tīng)int聽(tīng)DISPID_SHOW聽(tīng)=聽(tīng)1;
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)static聽(tīng)const聽(tīng)int聽(tīng)DISPID_SHOW2聽(tīng)=聽(tīng)2;
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)_ATL_FUNC_INFO聽(tīng)OnShowInfo聽(tīng)=
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)
{
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)CC_STDCALL,聽(tīng)//calling聽(tīng)conv
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)VT_EMPTY,//return聽(tīng)value
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)0聽(tīng),//number聽(tīng)of聽(tīng)arguments
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)NULL//argumnent聽(tīng)types
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)};
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)_ATL_FUNC_INFO聽(tīng)OnShow2Info聽(tīng)=
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)
{
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)CC_STDCALL,聽(tīng)//calling聽(tīng)conv
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)VT_EMPTY,//return聽(tīng)value
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)1聽(tīng),//number聽(tīng)of聽(tīng)arguments

聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)
{聽(tīng)VT_I2}//argumnent聽(tīng)types
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)};
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)}
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)class聽(tīng)CEventSink聽(tīng):聽(tīng)聽(tīng)public聽(tīng)I(yíng)DispEventImpl<1,聽(tīng)CEventSink,聽(tīng)&DIID__IAtlTest2Events,聽(tīng)&LIBID_TEST2Lib>
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)
{
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)public:聽(tīng)
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)CEventSink()
{};
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)virtual聽(tīng)~CEventSink()
{};
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)void聽(tīng)__stdcall聽(tīng)OnShow();聽(tīng)//娌℃湁鍙傛暟鐨勬儏鍐?/span>
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)void聽(tīng)__stdcall聽(tīng)OnShow2(short);//鏈夊弬鏁扮殑鎯呭喌
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)//蹇呴』瑕佺敤SINK_ENTRY_INFO,蹇呴』鎸囧畾鍙傛暟淇℃伅
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)BEGIN_SINK_MAP(CEventSink)
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)SINK_ENTRY_INFO(1,DIID_ISimpleCOMEvents,DISPID_SHOW,OnShow,&OnShowInfo)
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)SINK_ENTRY_INFO(1,DIID_ISimpleCOMEvents,DISPID_SHOW2,OnShow2,&OnShow2Info)
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)END_SINK_MAP()
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)};
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)#endif