[DllImport("wininet.dll", SetLastError=true)]
static extern TODO PrivacyGetZonePreference(TODO);
<DllImport("wininet.dll", SetLastError:=True, CharSet:=CharSet.Auto, EntryPoint:="PrivacySetZonePreferenceW", CallingConvention:=CallingConvention.StdCall)> _
Shared Function PrivacySetZonePreference( ByVal dwZone As Integer, ByVal dwType As Integer, ByVal dwTemplate As Integer, <MarshalAs(UnmanagedType.LPWStr)> ByVal lpszPreference As StringBuilder) As Integer
End Function
Public Const ERROR_MORE_DATA As Integer = 234
' URL Zone
Public Const URLZONE_PREDEFINED_MIN As Integer = 0
Public Const URLZONE_LOCAL_MACHINE As Integer = 0
Public Const URLZONE_INTRANET As Integer = URLZONE_LOCAL_MACHINE + 1
Public Const URLZONE_TRUSTED As Integer = URLZONE_INTRANET + 1
Public Const URLZONE_INTERNET As Integer = URLZONE_TRUSTED + 1
Public Const URLZONE_UNTRUSTED As Integer = URLZONE_INTERNET + 1
Public Const URLZONE_PREDEFINED_MAX As Integer = 999
Public Const URLZONE_USER_MIN As Integer = 1000
Public Const URLZONE_USER_MAX As Integer = 10000
' Cookie States
Public Const COOKIE_STATE_ACCEPT As Integer = &H1
Public Const COOKIE_STATE_PROMPT As Integer = &H2
Public Const COOKIE_STATE_LEASH As Integer = &H3
Public Const COOKIE_STATE_DOWNGRADE As Integer = &H4
Public Const COOKIE_STATE_REJECT As Integer = &H5
' Privacy Type
Public Const PRIVACY_TYPE_FIRST_PARTY As Integer = 0
Public Const PRIVACY_TYPE_THIRD_PARTY As Integer = 1
' Privacy Templates
Public Const PRIVACY_TEMPLATE_NO_COOKIES As Integer = 0
Public Const PRIVACY_TEMPLATE_HIGH As Integer = 1
Public Const PRIVACY_TEMPLATE_MEDIUM_HIGH As Integer = 2
Public Const PRIVACY_TEMPLATE_MEDIUM As Integer = 3
Public Const PRIVACY_TEMPLATE_MEDIUM_LOW As Integer = 4
Public Const PRIVACY_TEMPLATE_LOW As Integer = 5
Public Const PRIVACY_TEMPLATE_CUSTOM As Integer = 100
Public Const PRIVACY_TEMPLATE_ADVANCED As Integer = 101
Public Const PRIVACY_TEMPLATE_MAX As Integer = 5
None.
Please add some!
Private Sub cmdGetPolicy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdGetPolicy.Click
Dim lResult As Integer
Dim dwZone As Integer
Dim dwParty As Integer
Dim dwBufferLength As Integer = 0
Dim dwTemplate As Integer
Dim sBuffer As StringBuilder
dwZone = cmbZone1.SelectedIndex
dwParty = cmbParty1.SelectedIndex
dwBufferLength = 256
sBuffer = New StringBuilder(" ", dwBufferLength)
' First we will want to make the call and get the template or the length of preference buffer
' 1MB in size should be enough for this test
'sBuffer = System.Runtime.InteropServices.Marshal.AllocHGlobal(dwBufferLength)
lResult = WininetAPI.PrivacyGetZonePreference(dwZone, dwParty, dwTemplate, sBuffer, dwBufferLength)
If lResult = WininetAPI.ERROR_MORE_DATA Then
sBuffer = Nothing
sBuffer = New StringBuilder(dwBufferLength)
lResult = WininetAPI.PrivacyGetZonePreference(dwZone, dwParty, dwTemplate, sBuffer, dwBufferLength)
End If
If lResult <> 0 Then
MsgBox("1st Party: There was an error: Code " & CStr(System.Runtime.InteropServices.Marshal.GetLastWin32Error()))
Else
If (dwBufferLength <= 1) Then
txtPreference.Text = "none"
Else
txtPreference.Text = sBuffer.ToString
End If
txtTemplate.Text = CStr(dwTemplate)
End If
End Sub
Do you know one? Please contribute it!