Delphi创建的Automation Object必须实现IObjectSafety接口,否则新版本IE会拒绝加载。主要代码如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
FObjectSafetyFlags: DWORD; function GetInterfaceSafetyOptions( const IID: TIID; pdwSupportedOptions, pdwEnabledOptions: PDWORD): HResult; var Unk : IUnknown; begin if (pdwSupportedOptions = nil ) or (pdwEnabledOptions = nil ) then begin Result := E_POINTER; Exit; end ; Result := QueryInterface(IID, Unk); if Result = S_OK then begin pdwSupportedOptions^ := INTERFACESAFE_FOR_UNTRUSTED_CALLER or INTERFACESAFE_FOR_UNTRUSTED_DATA; pdwEnabledOptions^ := FObjectSafetyFlags and (INTERFACESAFE_FOR_UNTRUSTED_CALLER or INTERFACESAFE_FOR_UNTRUSTED_DATA); end else begin pdwSupportedOptions^ := 0 ; pdwEnabledOptions^ := 0 ; end ; end ; function SetInterfaceSafetyOptions( const IID: TIID; dwOptionSetMask, dwEnabledOptions: DWORD): HResult; var Unk : IUnknown; begin Result := QueryInterface(IID, Unk); if Result <> S_OK then Exit; FObjectSafetyFlags := dwEnabledOptions and dwOptionSetMask; end ; |