Export (0) Print
Expand All

UIPermission.Clipboard Property

Gets or sets the clipboard access represented by the permission.

[Visual Basic]
Public Property Clipboard As UIPermissionClipboard
[C#]
public UIPermissionClipboard Clipboard {get; set;}
[C++]
public: __property UIPermissionClipboard get_Clipboard();
public: __property void set_Clipboard(UIPermissionClipboard);
[JScript]
public function get Clipboard() : UIPermissionClipboard;
public function set Clipboard(UIPermissionClipboard);

Property Value

One of the UIPermissionClipboard values.

Example

[Visual Basic] 
' The IsSubsetOf method determines whether the current permission is a subset of the specified permission.
' This demo uses the IsSubsetOf method to determine the relationship of two 
' UIPermissionWindow permissions and two UIPermissionClipboard permissions.
Private Function IsSubsetOfWindowAndClipboardDemo() As Boolean
    Dim returnValue As Boolean = True
    Dim ui1, ui2 As UIPermissionWindow
    Dim cb1, cb2 As UIPermissionClipboard
    Dim uiIdPerm1, uiIdPerm2 As UIPermission
    Dim uiGen1 As New UIGenerator()
    Dim uiGen2 As New UIGenerator()
    uiGen1.ResetIndex()
    While uiGen1.CreateUI(uiIdPerm1, ui1, cb1)
        If uiIdPerm1 Is Nothing Then
            GoTo ContinueWhile1
        End If
        uiGen2.ResetIndex()
        Console.WriteLine("********************************************************" & ControlChars.Lf)

        While uiGen2.CreateUI(uiIdPerm2, ui2, cb2)
            If uiIdPerm2 Is Nothing Then
                GoTo ContinueWhile2
            End If
            Try
                If uiIdPerm1.IsSubsetOf(uiIdPerm2) Then
                    Console.WriteLine(uiIdPerm1.Window.ToString() & " and " _
                    & uiIdPerm1.Clipboard.ToString() & " is a subset of " _
                    & uiIdPerm2.Window.ToString() & "  and  " & uiIdPerm2.Clipboard.ToString())
                Else
                    Console.WriteLine(uiIdPerm1.Window.ToString() & " and " _
                    & uiIdPerm1.Clipboard.ToString() & " is not a subset of " _
                    & uiIdPerm2.Window.ToString() & " and " & uiIdPerm2.Clipboard)
                End If
            Catch e As Exception
                Console.WriteLine("An exception was thrown  for subset :" & uiIdPerm1.ToString() _
                & ControlChars.Lf & uiIdPerm2.ToString() & ControlChars.Lf & e.ToString())
                returnValue = False
            End Try
ContinueWhile2:
        End While
ContinueWhile1:
    End While
    Return returnValue
End Function 'IsSubsetOfWindowAndClipboardDemo

' Compare two UIPemissionWindow permissions.
Private Function IsSubsetOfWindowDemo() As Boolean
    Dim returnValue As Boolean = True
    Dim ui1, ui2 As UIPermissionWindow
    Dim uiIdPerm1, uiIdPerm2 As UIPermission
    Dim uiGen1 As New UIGenerator()
    Dim uiGen2 As New UIGenerator()
    uiGen1.ResetIndex()
    While uiGen1.CreateUI(uiIdPerm1, ui1)
        If uiIdPerm1 Is Nothing Then
            GoTo ContinueWhile1
        End If
        uiGen2.ResetIndex()
        Console.WriteLine("********************************************************" & ControlChars.Lf)

        While uiGen2.CreateUI(uiIdPerm2, ui2)
            If uiIdPerm2 Is Nothing Then
                GoTo ContinueWhile2
            End If
            Try
                If uiIdPerm1.IsSubsetOf(uiIdPerm2) Then
                    Console.WriteLine(uiIdPerm1.Window.ToString() & " is a subset of " _
                    & uiIdPerm2.Window.ToString())
                Else
                    Console.WriteLine(uiIdPerm1.Window.ToString() & " is not a subset of " _
                    & uiIdPerm2.Window.ToString())
                End If
            Catch e As Exception
                Console.WriteLine(("An exception was thrown  for subset :" & uiIdPerm1.ToString() _
                & ControlChars.Lf & uiIdPerm2.ToString() & ControlChars.Lf & e.ToString()))
                returnValue = False
            End Try
ContinueWhile2:
        End While
ContinueWhile1:
    End While
    Return returnValue
End Function 'IsSubsetOfWindowDemo

' Compare two UIPermissionClipboard permissions.
Private Function IsSubsetOfClipboardDemo() As Boolean
    Dim returnValue As Boolean = True
    Dim cb1, cb2 As UIPermissionClipboard
    Dim uiIdPerm1, uiIdPerm2 As UIPermission
    Dim uiGen1 As New UIGenerator()
    Dim uiGen2 As New UIGenerator()
    uiGen1.ResetIndex()
    While uiGen1.CreateUI(uiIdPerm1, cb1)
        If uiIdPerm1 Is Nothing Then
            GoTo ContinueWhile1
        End If
        uiGen2.ResetIndex()
        Console.WriteLine("********************************************************" & ControlChars.Lf)

        While uiGen2.CreateUI(uiIdPerm2, cb2)
            If uiIdPerm2 Is Nothing Then
                GoTo ContinueWhile2
            End If
            Try
                If uiIdPerm1.IsSubsetOf(uiIdPerm2) Then
                    Console.WriteLine(uiIdPerm1.Clipboard.ToString() & " is a subset of " _
                    & uiIdPerm2.Clipboard.ToString())
                Else
                    Console.WriteLine(uiIdPerm1.Clipboard.ToString() & " is not a subset of " _
                    & uiIdPerm2.Clipboard.ToString())
                End If
            Catch e As Exception
                Console.WriteLine("An exception was thrown  for subset :" _
                & uiIdPerm1.ToString() & ControlChars.Lf & uiIdPerm2.ToString() _
                & ControlChars.Lf & e.ToString())
                returnValue = False
            End Try
ContinueWhile2:
        End While
ContinueWhile1:
    End While
    Return returnValue
End Function 'IsSubsetOfClipboardDemo


[C#] 
// The IsSubsetOf method determines whether the current permission is a subset of the specified permission.
// This demo uses the IsSubsetOf method to determine the relationship of two 
// UIPermissionWindow permissions and two UIPermissionClipboard permissions.
    private bool IsSubsetOfWindowAndClipboardDemo()
    {
        bool returnValue = true;
        UIPermissionWindow ui1,ui2;
        UIPermissionClipboard cb1, cb2;
        UIPermission uiIdPerm1,uiIdPerm2;
        UIGenerator uiGen1 = new UIGenerator();
        UIGenerator uiGen2 = new UIGenerator();
        uiGen1.ResetIndex();
        while(uiGen1.CreateUI(out uiIdPerm1, out ui1, out cb1)) 
        {
            if(uiIdPerm1 == null) continue;
            uiGen2.ResetIndex();
            Console.WriteLine("********************************************************\n");

            while(uiGen2.CreateUI(out uiIdPerm2, out ui2, out cb2)) 
            {
                if(uiIdPerm2 == null) continue;
                try
                {            
                    if (uiIdPerm1.IsSubsetOf(uiIdPerm2))
                    {
                        Console.WriteLine(uiIdPerm1.Window + " and " + uiIdPerm1.Clipboard + " is a subset of " + 
                            uiIdPerm2.Window  +  "  and  " + uiIdPerm2.Clipboard);
                    }
                    else
                    {
                        Console.WriteLine(uiIdPerm1.Window + " and " + uiIdPerm1.Clipboard + " is not a subset of " + 
                            uiIdPerm2.Window  +  " and " + uiIdPerm2.Clipboard);
                    }
                }
                catch(Exception e) 
                {
                    Console.WriteLine("An exception was thrown  for subset :" + uiIdPerm1 + "\n" + 
                        uiIdPerm2 +"\n" + e);
                    returnValue=false;
                }
            }
        }
        return returnValue;
    }
// Compare two UIPemissionWindow permissions.
    private bool IsSubsetOfWindowDemo()
    {
        bool returnValue = true;
        UIPermissionWindow ui1,ui2;
        UIPermission uiIdPerm1,uiIdPerm2;
        UIGenerator uiGen1 = new UIGenerator();
        UIGenerator uiGen2 = new UIGenerator();
        uiGen1.ResetIndex();
        while(uiGen1.CreateUI(out uiIdPerm1, out ui1)) 
        {
            if(uiIdPerm1 == null) continue;
            uiGen2.ResetIndex();
            Console.WriteLine("********************************************************\n");

            while(uiGen2.CreateUI(out uiIdPerm2, out ui2)) 
            {
                if(uiIdPerm2 == null) continue;
                try
                {            
                    if (uiIdPerm1.IsSubsetOf(uiIdPerm2))
                    {
                        Console.WriteLine(uiIdPerm1.Window + " is a subset of " + uiIdPerm2.Window );
                    }
                    else
                    {
                        Console.WriteLine(uiIdPerm1.Window + " is not a subset of " + uiIdPerm2.Window);
                    }
                }
                catch(Exception e) 
                {
                    Console.WriteLine("An exception was thrown  for subset :" + uiIdPerm1 + "\n" + 
                        uiIdPerm2 +"\n" + e);
                    returnValue=false;
                }
            }
        }
        return returnValue;
    }
// Compare two UIPermissionClipboard permissions.
    private bool IsSubsetOfClipboardDemo()
    {
        bool returnValue = true;
        UIPermissionClipboard cb1, cb2;
        UIPermission uiIdPerm1,uiIdPerm2;
        UIGenerator uiGen1 = new UIGenerator();
        UIGenerator uiGen2 = new UIGenerator();
        uiGen1.ResetIndex();
        while(uiGen1.CreateUI(out uiIdPerm1, out cb1)) 
        {
            if(uiIdPerm1 == null) continue;
            uiGen2.ResetIndex();
            Console.WriteLine("********************************************************\n");

            while(uiGen2.CreateUI(out uiIdPerm2, out cb2)) 
            {
                if(uiIdPerm2 == null) continue;
                try
                {            
                    if (uiIdPerm1.IsSubsetOf(uiIdPerm2))
                    {
                        Console.WriteLine(uiIdPerm1.Clipboard + " is a subset of " + uiIdPerm2.Clipboard);
                    }
                    else
                    {
                        Console.WriteLine(uiIdPerm1.Clipboard + " is not a subset of " + uiIdPerm2.Clipboard);
                    }
                }
                catch(Exception e) 
                {
                    Console.WriteLine("An exception was thrown  for subset :" + uiIdPerm1 + "\n" + 
                        uiIdPerm2 +"\n" + e);
                    returnValue=false;
                }
            }
        }
        return returnValue;
    }

[C++] 
// The IsSubsetOf method determines whether the current permission is a subset of the specified permission.
// This demo uses the IsSubsetOf method to determine the relationship of two 
// UIPermissionWindow permissions and two UIPermissionClipboard permissions.
private:
bool IsSubsetOfWindowAndClipboardDemo()
{
    bool returnValue = true;
    UIPermissionWindow ui1,ui2;
    UIPermissionClipboard cb1, cb2;
    UIPermission* uiIdPerm1;
    UIPermission* uiIdPerm2;
    UIGenerator* uiGen1 = new UIGenerator();
    UIGenerator* uiGen2 = new UIGenerator();
    uiGen1->ResetIndex();
    while(uiGen1->CreateUI(&uiIdPerm1, &ui1, &cb1)) 
    {
        if(uiIdPerm1 == 0) continue;
        uiGen2->ResetIndex();
        Console::WriteLine(S"********************************************************\n");

        while(uiGen2->CreateUI(&uiIdPerm2, &ui2, &cb2)) 
        {
            if(uiIdPerm2 == 0) continue;
            try
            {            
                if (uiIdPerm1->IsSubsetOf(uiIdPerm2))
                {
                    Console::WriteLine(S"{0} and {1} is a subset of {2}  and  {3}",
                        __box(uiIdPerm1->Window), __box(uiIdPerm1->Clipboard),
                        __box(uiIdPerm2->Window), __box(uiIdPerm2->Clipboard));
                }
                else
                {
                    Console::WriteLine(S"{0} and {1} is not a subset of {2} and {3}",
                        __box(uiIdPerm1->Window), __box(uiIdPerm1->Clipboard),
                        __box(uiIdPerm2->Window), __box(uiIdPerm2->Clipboard));
                }
            }
            catch(Exception* e) 
            {
                Console::WriteLine(S"An exception was thrown  for subset :{0}\n{1}\n{2}",
                    uiIdPerm1, uiIdPerm2, e);
                returnValue=false;
            }
        }
    }
    return returnValue;
}
// Compare two UIPemissionWindow permissions.
private:
bool IsSubsetOfWindowDemo()
{
    bool returnValue = true;
    UIPermissionWindow ui1,ui2;
    UIPermission* uiIdPerm1;
    UIPermission* uiIdPerm2;
    UIGenerator* uiGen1 = new UIGenerator();
    UIGenerator* uiGen2 = new UIGenerator();
    uiGen1->ResetIndex();
    while(uiGen1->CreateUI(&uiIdPerm1, &ui1)) 
    {
        if(uiIdPerm1 == 0) continue;
        uiGen2->ResetIndex();
        Console::WriteLine(S"********************************************************\n");

        while(uiGen2->CreateUI(&uiIdPerm2, &ui2)) 
        {
            if(uiIdPerm2 == 0) continue;
            try
            {            
                if (uiIdPerm1->IsSubsetOf(uiIdPerm2))
                {
                    Console::WriteLine(S"{0} is a subset of {1}",
                        __box(uiIdPerm1->Window), __box(uiIdPerm2->Window));
                }
                else
                {
                    Console::WriteLine(S"{0} is not a subset of {1}",
                        __box(uiIdPerm1->Window), __box(uiIdPerm2->Window));
                }
            }
            catch(Exception* e) 
            {
                Console::WriteLine(S"An exception was thrown  for subset :{0}\n{1}\n{2}",
                    uiIdPerm1, uiIdPerm2, e);
                returnValue=false;
            }
        }
    }
    return returnValue;
}
// Compare two UIPermissionClipboard permissions.
private:
bool IsSubsetOfClipboardDemo()
{
    bool returnValue = true;
    UIPermissionClipboard cb1, cb2;
    UIPermission* uiIdPerm1;
    UIPermission* uiIdPerm2;
    UIGenerator* uiGen1 = new UIGenerator();
    UIGenerator* uiGen2 = new UIGenerator();
    uiGen1->ResetIndex();
    while(uiGen1->CreateUI(&uiIdPerm1, &cb1)) 
    {
        if(uiIdPerm1 == 0) continue;
        uiGen2->ResetIndex();
        Console::WriteLine(S"********************************************************\n");

        while(uiGen2->CreateUI(&uiIdPerm2, &cb2)) 
        {
            if(uiIdPerm2 == 0) continue;
            try
            {            
                if (uiIdPerm1->IsSubsetOf(uiIdPerm2))
                {
                    Console::WriteLine(S"{0} is a subset of {1}",
                        __box(uiIdPerm1->Clipboard), __box(uiIdPerm2->Clipboard));
                }
                else
                {
                    Console::WriteLine(S"{0} is not a subset of {1}",
                        __box(uiIdPerm1->Clipboard), __box(uiIdPerm2->Clipboard));
                }
            }
            catch(Exception* e) 
            {
                Console::WriteLine(S"An exception was thrown  for subset :{0}\n{1}\n{2}",
                    uiIdPerm1, uiIdPerm2, e);
                returnValue=false;
            }
        }
    }
    return returnValue;
}

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

UIPermission Class | UIPermission Members | System.Security.Permissions Namespace

Show:
© 2014 Microsoft