0

I am developing a WIX installer. Set up requires active domain name as input while installation on a click of a button say "Browse". I googled a lot but found no way to implement. Please help to implement the same or suggest some other way to achieve this. Thanks.

himanshu
  • 417
  • 5
  • 18
  • 1
    I don't understand what you are asking. What do you mean by available active domain? Active Dirctory consists for forests and domains and there can be more then one domain available. Which one do you need? Why do you need it? Please explain your scenario clearly in more detail. – Christopher Painter Dec 03 '13 at 14:54
  • @ChristopherPainter: I want user to browse available domain in active directory. There may be multiple domains. Each domain may contain multiple user groups.On click Browse button, a dialog containing list of domains must be displayed so that user could select any one domain to continue the installation. Please let me know if you need more detail. – himanshu Dec 04 '13 at 04:53
  • What programming language do you want to write the custom action in? C++, C#? – Christopher Painter Dec 04 '13 at 12:27
  • c#. But do I really need to write custom action? Is there no built in extension in WIX to achieve the same? – himanshu Dec 04 '13 at 12:46
  • 1
    You tagged the question custom-action yourself. There is no built in extension. Do you have to write one? Probably not. I'm not sure what you are going to use this for but you could possibly defer it to first run of the application and handle it there. – Christopher Painter Dec 04 '13 at 12:53

1 Answers1

4

Here is a high level outline of how to do what you want.

Create your dialog that will have the browse button. (Dialog Parent) Create your dialog that will display the list of domains (Dialog Child) Configure your Publish elements (ControlEvents) on the Dialog Parent Browse Button to spawn the Child dialog.

Create a custom action in C++ or C# that queries Windows API's to get a list of domain the forest. Use Windows Installer API's to populate temporary rows into the ListBox table. This table will be used the ListBox control on the Child dialog. You may need to use an EnsureTable element to make sure the ListBox table gets created.

In C# you can read how to get a list of domains here: How to get a list of all domains?

To learn about temporary records look at my blog here: Dynamic Windows Installer UI

Schedule the custom action to run in the UI sequence after AppSearch. Build and test.

Here's how it works. The installer starts and runs the CA. The CA gets a list of domains and inserts temporary rows into the ListBox table as if they were authored at build time. The user gets to dialog parent and clicks the browse button. The child dialog is spawned (modal on top) and displays the list of domains. They select a record and the value associated with the record is set to the property associated with the ListBox. They click OK then Next and go about their merry way. Later you use the property somewhere like a Registry entry by saying [SELECTEDDOMAIN] or whatever else you called the property.

Since we are talking about properties with user configuration data, now is a good time to mention:

The WiX toolset's "Remember Property" pattern

This is the most detailed answer I can provide without doing the work for you. Additional assistance is available at an hourly rate.

Community
  • 1
  • 1
Christopher Painter
  • 54,556
  • 6
  • 63
  • 100