Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7647469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:28:08+00:00 2026-05-31T10:28:08+00:00

Is the Windows Select Users, Service Accounts, or Groups dialog: available through an API

  • 0

Is the Windows Select Users, Service Accounts, or Groups dialog:

enter image description here

available through an API to 3rd party developers?

Is there a “AD Browser” common dialog?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T10:28:10+00:00Added an answer on May 31, 2026 at 10:28 am

    Directory Object Picker

    Sample pseudo-code:

    String SelectUsers(HWND hwndParent, IList<String> usersLdapPaths)
    {
       IDsObjectPicker objPicker;
       IDataObject objData;
       PDSOP_INIT_INFO pInfo;
       LPWSTR[0..2] attr;
       HRESULT hr;
    
       /*
          Returns the LDAP path to the selected user, e.g.:
             LDAP://stackoverflow.com/CN=Ian Boyd,OU=Stack Users,DC=stackoverflow,DC=com
    
          usersLdapPaths can be null. 
          If not null then the user can mutli-select users, 
          and the selected user's LDAP paths will be returned in usersLdapPaths 
          (with the function result containing just the first user)
    
          If the user cancels the dialog, then the result (and usersLdapPaths ) will be empty
       */
       Result := '';
    
       objPicker = CreateComObject(CLSID_DsObjectPicker) as IDsObjectPicker;
    
       System.New(pInfo);
       try
       {
          ZeroMemory(pInfo, SizeOf(DSOP_INIT_INFO));
          pInfo.cbSize = SizeOf(DSOP_INIT_INFO);
          pInfo.pwzTargetComputer = nil; //local computer
    
          pInfo.cDsScopeInfos := 1;
          System.New(pInfo.aDsScopeInfos);
          try
          {
             ZeroMemory(pInfo.aDsScopeInfos, SizeOf(DSOP_SCOPE_INIT_INFO));
             pInfo.aDsScopeInfos.cbSize = SizeOf(pInfo.aDsScopeInfos);
             pInfo.aDsScopeInfos.flType = DSOP_SCOPE_TYPE_UPLEVEL_JOINED_DOMAIN;  //or DSOP_SCOPE_TYPE_TARGET_COMPUTER;
             pInfo.aDsScopeInfos.flScope = DSOP_SCOPE_FLAG_WANT_PROVIDER_LDAP;
             pInfo.aDsScopeInfos.FilterFlags.Uplevel.flBothModes = DSOP_FILTER_USERS;
             pInfo.aDsScopeInfos.FilterFlags.flDownlevel = DSOP_DOWNLEVEL_FILTER_USERS;
    
             if (UsersLdapPaths != null)
                pInfo.flOptions = DSOP_FLAG_MULTISELECT;
    
             pInfo.cAttributesToFetch := 3;
             attr[0] = "description";
             attr[1] = "name";
             attr[2] = "fullName";
             pInfo.apwzAttributeNames = @attr;
    
             hr = objPicker.Initialize(pInfo);
             OleCheck(hr);
             hr = objPicker.InvokeDialog(hwndParent, objData);
             OleCheck(hr);
    
             //the result is false if the user cancelled the dialog
             if hr = S_FALSE then
                return '';
    
             return ReadAttributes(objData, UsersLdapPaths);
          }
          finally
          {
             System.Dispose(pInfo.aDsScopeInfos);
          }      
       }
       finally
       {
          Dispose(pInfo);
       }
    }
    

    And the helper function (that i won’t bother to transcode from one pseudocode language to another pseudocode language):

    function TActiveDirectory.ReadAttributes(ADataObject: IDataObject; AValues: TStrings): string;
    var
        fmtIn: TFormatEtc;
        stgOut: TStgMedium;
        pSelList: PDS_SELECTION_LIST;
        i: Integer;
        path: string;
    //  x: LongWord;
    //  pVar: POleVariant;
        items: PDsSelectionArray;
    begin
        Result := '';
    
        if Assigned(AValues) then
            AValues.Clear;
    
        if not Assigned(ADataObject) then
            Exit;
    
        stgOut.tymed := TYMED_HGLOBAL;
        fmtIn.tymed := TYMED_HGLOBAL;
        fmtIn.cfFormat := RegisterClipboardFormat(CFSTR_DSOP_DS_SELECTION_LIST);
        fmtIn.dwAspect := DVASPECT_CONTENT;
        fmtIn.lindex := -1;
    
        if (ADataObject.GetData(fmtIn, stgOut) <> S_OK) then
            Exit;
    
        pSelList := GlobalLock(stgOut.hGlobal);
        try
            if pSelList.cItems > 0 then
                items := PDsSelectionArray(@pSellist.aDsSelection)
            else
                items := nil;
    
            for i := 0 to pSelList^.cItems-1 do
            begin
    //          path := TDsSelectionArray(pSellist.aDsSelection)[i].pwzADsPath;
                path := items[i].pwzADsPath;
    
                if Assigned(AValues) then
                    AValues.Add(path);
    
                if Result = '' then
                    Result := path;
    
    {           Result := pSelList^.aDsSelection[i].pwzName+' ('+pSelList.aDsSelection[i].pwzADsPath+')';
                AValues.Add(Result);
                AValues.Add('   Class: '+pSelList^.aDsSelection[i].pwzClass); //"user"
                AValues.Add('   UPN: '+pSelList^.aDsSelection[i].pwzUPN );    //e.g. "ian@stackoverflow.com"
                pVar := pSelList^.aDsSelection[i].pvarFetchedAttributes;
                for x := 0 to pSelList^.cFetchedAttributes-1 do
                begin
                    AValues.Add('   '+VarToStr(pVar^));
                    if x < pSelList^.cFetchedAttributes then
                        Inc(pVar);
                end;}
            end;
        finally
            GlobalUnlock(stgOut.hGlobal);
        end;
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like to allow users of my Windows game to use a dialog box
Does IO::Select in Windows work with filehandles? $pid = open $handle, -|, $_command ||
I have created a process using proc-open but under windows the stream-select does not
Trying to programmatically add options to a SELECT drop down in IE Windows Mobile.
Windows Forms: For System.Drawing there is a way to get the font height. Font
I'm trying to search the Indexing Service of a remote Windows 2003 server from
This thread is the continuation of the below thread Trigger Windows Service when the
SELECT * FROM users WHERE TO_SECONDS(NOW())-TO_SECONDS(TS) <= 604800 TS is timestamp column. 604800 is
I'm looking for a (preferably free) component for Delphi for users to easily select
I've installed a Windows Service on several computers. I had to logon on as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.