Need a dialog to prompt for a user name and password...

Got a problem you cannot solve? Try here.
Post Reply
Sheri_Steeves
Posts: 124
Joined: Mon Oct 22, 2012 2:14 pm

Need a dialog to prompt for a user name and password...

Post by Sheri_Steeves »

Hello,

In my install I need to prompt the user for a user name and password to use when installing certain components. In most cases this is a different user from the one running the install program.

In Wise Installer I was able to use a pre-built Logon Information dialog. Does InstallAware have anything similar to this or will I have to add a custom dialog my self?

Thanks,

Sheri
bokkie
Posts: 767
Joined: Sun Feb 08, 2009 6:30 am

Re: Need a dialog to prompt for a user name and password...

Post by bokkie »

Sheri,

I've not seen a standard dialog that does it so you might have to think of hand-rolling your own. When you mentioned Wise have you tried using IA's conversion utility on a Wise project? I've never used Wise so I can't comment on what the converter can do. Perhaps it's possible it might handle it for you and so emit some MSIcode?

Right now, I think it might be quicker to copy an existing dialog and edit it to do what you need.

Edit: If you copy an existing dialog might I suggest you make a full backup of your project first.
Peter. Smartly dressed, he still resembles an unmade bed.
InstallAware MVP
Sheri_Steeves
Posts: 124
Joined: Mon Oct 22, 2012 2:14 pm

Re: Need a dialog to prompt for a user name and password...

Post by Sheri_Steeves »

Bokkie,

Thanks for the reply. I did try importing my Wise project but it was from a really old version of Wise (version 7.0) and the .wsi is not a supported project in the Wise converter.

Sheri
FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Need a dialog to prompt for a user name and password...

Post by FrancescoT »

Dear Sheri,

as Bokkie suggested, it is not available a ready to use dialog that have User and Password fields ... but it can be easly implemented.

For example you could use the User Registration dialog (that it is available with almost all InstallAware dilaog themes), as starting point to create your customized dialog.

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Sheri_Steeves
Posts: 124
Joined: Mon Oct 22, 2012 2:14 pm

Re: Need a dialog to prompt for a user name and password...

Post by Sheri_Steeves »

Franscesco,

Thanks for the reply; that's kind of what I thought but I wanted to make sure I wasn't missing someting obvious.

Do you know how I would go about validating the domain/user/password information before allowing the user to move to the next dialog?
FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Need a dialog to prompt for a user name and password...

Post by FrancescoT »

Dear User,

do you mean in wich way you can handle the user imput with variable?

If true, I may suggest you to have a look at the "Serial Validation" sample.
It describes how to validate a serial number entered by the user, it is not exactly what you are looking for, but I really suppose that could help you.

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Sheri_Steeves
Posts: 124
Joined: Mon Oct 22, 2012 2:14 pm

Re: Need a dialog to prompt for a user name and password...

Post by Sheri_Steeves »

Franscesco,

I have my new Logon Dialog and and am placing the domain/user/password into variables and later using them when I install my service.

What I want to be able to do is validate that the domain\user\password entered are valid BEFORE I let the user go to the next screen. Ideally the Next button could remain disabled but I will settle for a message box stating the error and reverting back to the logon screen.

I was going to look at the serial validation sample as I thought that was fairly close to the behaviour I wanted.

The dialog I am trying to duplicate also allows the user to select the domain/user from a list box (user presses a button and the listbox is populated with users/domains to choose from) - this is ultimately the behaviour I need in this custom dialog.

Sheri
bokkie
Posts: 767
Joined: Sun Feb 08, 2009 6:30 am

Re: Need a dialog to prompt for a user name and password...

Post by bokkie »

Sheri,

The attached project isn't quite what you're after perhaps but it shows a combobox in a dialog and the use of a default selection. If you scroll down the MSIcode you'll see the combobox's usage and the return value it passes back. A quick inspection inside the dialog it's used in will nail down the rest of its use. As I say, it might not be exactly what you want but it might get you started.
Attachments
Combobox test.7z
Example project demonstrating combobox.
(194.52 KiB) Downloaded 411 times
Peter. Smartly dressed, he still resembles an unmade bed.
InstallAware MVP
Sheri_Steeves
Posts: 124
Joined: Mon Oct 22, 2012 2:14 pm

Re: Need a dialog to prompt for a user name and password...

Post by Sheri_Steeves »

Bokkie,

Thanks for the sample project - I did find information on how to fill combo boxes and listboxes, and this sample can only help!

My next issue is getting the information to fill my domain and user listboxes.

My first thought was to use a small utility program (C# most likely) that would return the string of available domains, or the users available on a particular domain passed in.

Then I ran into the problem of where I want to run this code (before I show my custom logon dialog), my install files haven't been copied to disk yet... How can I run a sample program or dll in this scenario?

I did have a quick look at the plug-in architecture but it seems like overkill for what I am trying to do.

Any suggestions?

Sheri
bokkie
Posts: 767
Joined: Sun Feb 08, 2009 6:30 am

Re: Need a dialog to prompt for a user name and password...

Post by bokkie »

Sheri,

What you can do is go ahead and create a C# executable. Then, add the exe and any other assemblies you need into your project as a file bag. By the way, you will probably assume the Dotnet framework your exe requires is already installed on the machine you're running your installation on. There's a standard plugin called File Bag which you use in your MSIcode. When you define the file bag you can give the name of a variable (make sure you define it first) and that will return the pathname where your file bag will be located during the installation. File bags are always temporary; IA pulls the definition for them when it executes the statement. In other words, file bags are not dependent on being installed before use. IA does it on-the-fly for you.

Once you've defined the file bag and you got its location passed back to you in the variable you specified you can then run the exe using the Run Program statement. Pass any command line arguments into the exe you require and set the mode of the program to wait for execution to complete. A cautionary note about the arguments which I'm sure you know about is to be careful about quoting arguments which have implied spaces. Simple numbers aren't a problem obviously.

Assuming yours is a standard console program with a conventional entry point of static int Main(string[] args) let it harvest the domains, etc you need to use and if you want, return a DOS error code back to the result variable at the bottom of the Run Program dialog. You can then check the return code in your MSIcode to see if your exe returned anything that needs attention.

How you do this next part is for you to decide. You need to return strings containing domains and what have you but when you run a DOS-style command the best you're going to get is an integer return code only. So, in your exe you might want to write the strings to a text file and read them back during the installation just before you pop up your custom dialog or, perhaps write them to the registry. There are statements to read files and registry items. This should hopefully get you on the road.

The C# plugin would be simpler to an extent but yes, it can be a little tricky to implement. If you need to replicate what I've suggested in more than one project then a plugin does become more economical.
Peter. Smartly dressed, he still resembles an unmade bed.
InstallAware MVP
Sheri_Steeves
Posts: 124
Joined: Mon Oct 22, 2012 2:14 pm

Re: Need a dialog to prompt for a user name and password...

Post by Sheri_Steeves »

Bokkie,

Wow, yes of course, the FileBag. This is exactly what I needed to do.

I had found the Run command before install) but I was stuck with the problem of the C# program needing it's .config as well as the executable.

I had determined that I needed to get the domains, users etc into a file and to read that file(s) to fill the list boxes on my dialog.

Is there a way to change the contents of a list box dynamically - say I have local computer domain with users x and y and a network domain with user a, b and c. Depending on which domain is chosen the contents listed in the second list box will need to change.

Sheri
bokkie
Posts: 767
Joined: Sun Feb 08, 2009 6:30 am

Re: Need a dialog to prompt for a user name and password...

Post by bokkie »

Sheri,

Despite my best efforts I can't think of anyway you can do what you want within the dialog itself. Buttons are okay as they can force the dialog to exit at which point you could then determine what button was pushed and then take action and if necessary go back to the dialog again. Apart from being able to change some properties of combo boxes and list boxes there are no options to enforce a button press. That is, I could set properties of a button but not fire the button's click response using the combo box as a trigger to do so.

I could see two possible options but I've not tested them yet so take what I suggest under a good deal of caution:

1. In the dialog, add some invisible list boxes all on top of each other. When you select an item in the combo box add an action and check the selected item index. If it's say, 0, then make the appropriate list box visible and hide the others. Then again, if you don't know how many selectable items there are in the combo box you'd have a problem as you obviously can't add list boxes on the fly. If you know there'd only be say, four items in the combo box it's do-able but hardly perfect.

2. Have a sort of "..." ellipsis button next to the combo box. When you select an item in the combo box, do nothing unless the user clicks the "..." button to "refresh" the list box. You can set a variable on the way out and use that to determine what combo box item was selected. You could then populate the list box with the items appropriate for the combo box item and you can then add the items to the list box and go back into the dialog. Do-able but perhaps messy.

I suppose we'd love IA to have a fully event-driven engine but we don't. In a way, a plugin would have been useful as you could drive it all from C# knowing when you select an item from a combo box you can then truly populate the list box dynamically and put the logic into a Windows form. Sorry I can't think of anything else.
Peter. Smartly dressed, he still resembles an unmade bed.
InstallAware MVP
Post Reply