I am trying to set an integer variable to a combination of an enum
values, the enum
is:
public enum WebBrowserDownloadControlFlags : uint
{
DLIMAGES = 0x00000010,
VIDEOS = 0x00000020,
BGSOUNDS = 0x00000040,
NO_SCRIPTS = 0x00000080,
NO_JAVA = 0x00000100,
NO_RUNACTIVEXCTLS = 0x00000200,
NO_DLACTIVEXCTLS = 0x00000400,
DOWNLOADONLY = 0x00000800,
NO_FRAMEDOWNLOAD = 0x00001000,
RESYNCHRONIZE = 0x00002000,
PRAGMA_NO_CACHE = 0x00004000,
NO_BEHAVIORS = 0x00008000,
NO_METACHARSET = 0x00010000,
URL_ENCODING_DISABLE_UTF8 = 0x00020000,
URL_ENCODING_ENABLE_UTF8 = 0x00040000,
NOFRAMES = 0x00080000,
FORCEOFFLINE = 0x10000000,
NO_CLIENTPULL = 0x20000000,
SILENT = 0x40000000,
OFFLINEIFNOTCONNECTED = 0x80000000,
OFFLINE = OFFLINEIFNOTCONNECTED,
}
The DownloadControlFlags
is an integer field:
public int DownloadControlFlags
{
get
{
return _downloadControlFlags;
}
set
{
if (_downloadControlFlags == value)
return;
_downloadControlFlags = value;
IOleControl ctl = (IOleControl)ActiveXInstance;
ctl.OnAmbientPropertyChange(DISPID_AMBIENT_DLCONTROL);
}
}
To set this variable I used summation as :
webBrowser1.DownloadControlFlags = (int)WebBrowserDownloadControlFlags.DLIMAGES
+ (int)WebBrowserDownloadControlFlags.NOFRAMES
+ (int)WebBrowserDownloadControlFlags.NO_FRAMEDOWNLOAD
+ (int)WebBrowserDownloadControlFlags.NO_JAVA
+ (int)WebBrowserDownloadControlFlags.NO_DLACTIVEXCTLS
+ (int)WebBrowserDownloadControlFlags.NO_BEHAVIORS
+ (int)WebBrowserDownloadControlFlags.NO_RUNACTIVEXCTLS
+ (int)WebBrowserDownloadControlFlags.SILENT;
I am not sure if it is the correct way, but it seems that it works. But now I want to check if the variable contains an specific value or not. For normal enum
the solution could be the answer of this question How to check if any flags of a flag combination are set?, but I am not sure if I can use the same way in my case.
How can I check if a specific flag has been set or not?! for example if the DownloadControlFlags
contains WebBrowserDownloadControlFlags.NO_JAVA
or not!