コード例 #1
0
    public static void Main()
    {
        // initialize all members
        DSBrowseInfo dsbi = new DSBrowseInfo();

        dsbi.structSize    = Marshal.SizeOf(dsbi);
        dsbi.dlgCaption    = "The container picker";
        dsbi.treeViewTitle = "Pick a container for this example.";

        dsbi.path     = new string( new char[MAX_PATH]);
        dsbi.pathSize = dsbi.path.Length;

        dsbi.flags = LibWrap.DSBI_ENTIREDIRECTORY;

        dsbi.objectClass     = new string( new char[MAX_PATH]);
        dsbi.objectClassSize = dsbi.objectClass.Length;

        Console.WriteLine("Call DSBrowseForContainer...");

        int status = LibWrap.DsBrowseForContainerW(ref dsbi);

        Console.WriteLine("The status is " + status);
        if (status == 1)
        {
            Console.WriteLine("The path is " + dsbi.path);
        }
        else
        {
            Console.WriteLine("Call failed!");
        }
    }
コード例 #2
0
 internal static extern DialogBoxResult DsBrowseForContainerW([In] DSBrowseInfo pInfo);
コード例 #3
0
 public static extern int DsBrowseForContainerW(ref DSBrowseInfo info);
コード例 #4
0
 /// <summary>
 /// The DsBrowseForContainer function displays a dialog box used to browse for container
 /// objects in Active Directory Domain Services.
 /// </summary>
 /// <param name="pInfo">Pointer to a DSBROWSEINFO structure that contains data about initializing
 /// the container browser dialog and receives data about the selected object.</param>
 /// <returns>
 /// The function returns one of the following values.
 ///
 /// -1
 ///
 /// An error occurred.
 /// IDCANCEL
 ///
 /// The user canceled the dialog box.
 /// IDOK
 ///
 /// The user selected an object in the dialog box and accepted the selection.
 /// </returns>
 public static DialogBoxResult DsBrowseForContainer([In] DSBrowseInfo pInfo)
 {
     return(Environment.OSVersion.Platform >= PlatformID.Win32NT ? Native.DsBrowseForContainerW(pInfo) : Native.DsBrowseForContainerA(pInfo));
 }