none
Show the Window's "Select User or Group" dialog box RRS feed

  • Question

  • Hi,

    Does anyone knows how to display the Window's "Select User or Group" dialog box through C# or VB.NET and then retrieve whatever value it returns upon pressing the OK button?

    You can normally see this dialog through many places and most common being,

    * Open Windows Explorer
    * Locate any folder
    * Right click on the folder and click properties
    * Go to the "Security" tab and click on the "Advanced" button at the bottom right of the dialog
    * There you can see the "Add", "Edit", "Remove" buttons for mucking around with permissions
    * Click on the "Add" button

    Now that will bring on the dialog I am after. I need to show that dialog via code and when the user press OK after selecting a user or group I need to retrieve what that value it.

    What I have is an application where a user's fully qualified domain name is stored in the SQL Server database where it's used throughout for auditing purposes and also defining our own set of security on the program which isn't always possible even by grouping users at the domain level.

    Is this possible?

    Cheers

    P.S. My apologies if I have posted this in a wrong forum section.
    Thursday, June 12, 2008 1:57 AM

Answers

  • The dialog is implemented by c:\windows\system32\aclui.dll.  It doesn't have a type library so you can't easily interface to it from a managed program.  It has just two unmanaged entrypoints, EditSecurity() and CreateSecurityPage(), documented in the MSDN library.  P/Invoking these functions is extraordinarily tricky.  Google might have something.

    Please use this forum only to ask questions about the CLR.

    Hans Passant.
    • Marked as answer by CodeLake Sunday, June 15, 2008 11:43 PM
    Saturday, June 14, 2008 6:58 PM
    Moderator

All replies

  • Ok so I have done a little more research and found that the dialog I am after is actually a COM application or dll so I assume there is no native implementation of that in .NET

    Am I correct or I have got it wrong?
    Friday, June 13, 2008 11:33 PM
  • The dialog is implemented by c:\windows\system32\aclui.dll.  It doesn't have a type library so you can't easily interface to it from a managed program.  It has just two unmanaged entrypoints, EditSecurity() and CreateSecurityPage(), documented in the MSDN library.  P/Invoking these functions is extraordinarily tricky.  Google might have something.

    Please use this forum only to ask questions about the CLR.

    Hans Passant.
    • Marked as answer by CodeLake Sunday, June 15, 2008 11:43 PM
    Saturday, June 14, 2008 6:58 PM
    Moderator
  • Hi,

    First of all, my apologies for posting this into wrong section. I looked but couldn't find forum related to this so I looked for word "Security" and CLR had it in it's description so post was made here.

    Anyways, thanks for the answer and pointing out the name of the dll. Yes I think I might have to work out something or as a last resort make my own dialog like that using the managed code.

    Cheers,
    Nirav Patel
    Sunday, June 15, 2008 11:43 PM