Menu

[r2509]: / trunk / Src / UUrlMonEx.pas  Maximize  Restore  History

Download this file

143 lines (119 with data), 4.7 kB

  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
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
{
* This Source Code Form is subject to the terms of the Mozilla Public License,
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
* obtain one at http://mozilla.org/MPL/2.0/
*
* Copyright (C) 2012, Peter Johnson (www.delphidabbler.com).
*
* $Rev$
* $Date$
*
* Imports a function from UrlMon.dll that is only present on later versions of
* Windows.
}
unit UUrlMonEx;
interface
uses
// Delphi
Windows, UrlMon;
const
// Internet Explorer feature controls.
// For documentation see http://msdn.microsoft.com/en-us/library/ms537169
FEATURE_OBJECT_CACHING = 0;
FEATURE_ZONE_ELEVATION = 1;
FEATURE_MIME_HANDLING = 2;
FEATURE_MIME_SNIFFING = 3;
FEATURE_WINDOW_RESTRICTIONS = 4;
FEATURE_WEBOC_POPUPMANAGEMENT = 5;
FEATURE_BEHAVIORS = 6;
FEATURE_DISABLE_MK_PROTOCOL = 7;
FEATURE_LOCALMACHINE_LOCKDOWN = 8;
FEATURE_SECURITYBAND = 9;
FEATURE_RESTRICT_ACTIVEXINSTALL = 10;
FEATURE_VALIDATE_NAVIGATE_URL = 11;
FEATURE_RESTRICT_FILEDOWNLOAD = 12;
FEATURE_ADDON_MANAGEMENT = 13;
FEATURE_PROTOCOL_LOCKDOWN = 14;
FEATURE_HTTP_USERNAME_PASSWORD_DISABLE = 15;
FEATURE_SAFE_BINDTOOBJECT = 16;
FEATURE_UNC_SAVEDFILECHECK = 17;
FEATURE_GET_URL_DOM_FILEPATH_UNENCODED = 18;
FEATURE_TABBED_BROWSING = 19;
FEATURE_SSLUX = 20;
FEATURE_DISABLE_NAVIGATION_SOUNDS = 21;
FEATURE_DISABLE_LEGACY_COMPRESSION = 22;
FEATURE_FORCE_ADDR_AND_STATUS = 23;
FEATURE_XMLHTTP = 24;
FEATURE_DISABLE_TELNET_PROTOCOL = 25;
FEATURE_FEEDS = 26;
FEATURE_BLOCK_INPUT_PROMPTS = 27;
FEATURE_ENTRY_COUNT = 28;
const
// Flags that specify where to set an Internet Explorer feature control
// For documentation see http://msdn.microsoft.com/en-us/library/ms537168
SET_FEATURE_ON_THREAD = $00000001;
SET_FEATURE_ON_PROCESS = $00000002;
SET_FEATURE_IN_REGISTRY = $00000004;
SET_FEATURE_ON_THREAD_LOCALMACHINE = $00000008;
SET_FEATURE_ON_THREAD_INTRANET = $00000010;
SET_FEATURE_ON_THREAD_TRUSTED = $00000020;
SET_FEATURE_ON_THREAD_INTERNET = $00000040;
SET_FEATURE_ON_THREAD_RESTRICTED = $00000080;
type
/// <summary>Type of CoInternetSetFeatureEnabled function imported from
/// UrlMon.dll used to enable or disable an Internet Explorer feature
/// control.</summary>
/// <param name="FeatureEntry">DWORD [in] Specifies feature control to enable
/// or disable.</param>
/// <param name="Flags">DWORD [in] Specifies where to set the feature control
/// value.</param>
/// <param name="Enable">BOOL [in] Specifies whether the feature control is
/// enables (True) or disabled (False).</param>
/// <returns>HResult. S_OK on success, E_FAIL on failure (or, in this
/// implementation, E_NOTIMPL if the function is not implemented.</returns>
/// <remarks>Supported from Windows XP SP2, Windows Server 2003 (and Internet
/// Explorer 6.0).</remarks>
TCoInternetSetFeatureEnabled = function(
FeatureEntry: DWORD;
Flags: DWORD;
Enable: BOOL
): HResult; stdcall;
var
// Pointer to CoInternetSetFeatureEnabled function imported from UrlMon.dll,
// or to a fallback function if UrlMon.dll does not export
// CoInternetSetFeatureEnabled.
// NOTE: The fallback function does nothing and simply returns E_NOTIMPL.
CoInternetSetFeatureEnabled: TCoInternetSetFeatureEnabled;
implementation
uses
// Delphi
SysUtils;
var
// Handle to UrlMon.dll</summary>
LibHandle: THandle;
/// <summary>Fallback function for use when UrlMon.dll does not export
/// CoInternetSetFeatureEnabled.</summary>
/// <remarks>Does nothing and returns E_NOTIMPL.</remarks>
function CoInternetSetFeatureEnabledFallback(FeatureEntry: DWORD;
Flags: DWORD; Enable: BOOL): HResult; stdcall;
begin
Result := E_NOTIMPL;
end;
/// <summary>Initialises CoInternetSetFeatureEnabled function pointer.
/// </summary>
procedure Init;
begin
LibHandle := SafeLoadLibrary('urlmon.dll');
CoInternetSetFeatureEnabled := nil;
if LibHandle <> 0 then
CoInternetSetFeatureEnabled := GetProcAddress(
LibHandle, 'CoInternetSetFeatureEnabled'
);
if not Assigned(CoInternetSetFeatureEnabled) then
CoInternetSetFeatureEnabled := CoInternetSetFeatureEnabledFallback;
end;
initialization
Init;
finalization
FreeLibrary(LibHandle);
end.
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.