Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help for newbie w/external UI

46 views
Skip to first unread message

Bill Henning

unread,
Dec 8, 2005, 12:31:10 PM12/8/05
to
Hi there, I'm experimenting with using C# (.NET 1.0) Windows Forms as a
custom external UI for an MSI package since all our end users will have .NET
1.0 on their machines.

I've got a Wizard based app started and I'm able to open the MSI using
MsiOpenPackage. This of course lets me get property values and list
features, etc. So that's all fine but then I get to the wizard step when I
need to install the features.

What is the best way to do this? The problem I have is that I tried API's
like MsiInstallProduct or MsiConfigureProduct but those complain that the
MSI is already running, probably because of my open package handle from
MsiOpenPackage.

Considering that I have an external UI, what is the best way to kick off the
normal installation routines with an API while still keeping my package
handle open? And also how do I indicate that I would want to uninstall
features when in a maintenance mode?

Thanks in advance!

Bill


mgama

unread,
Dec 8, 2005, 6:27:48 PM12/8/05
to
To accomplish what you are asking, first I would do an MsiOpenDatabase (all
the API's I'm using are p/invoked) to open the database for read-only. Now
with this handle, I can it to do queries and what not (MsiDatabaseOpenView >
MsiViewExecute > MsiViewFetch > MsiRecordGetString).

Now to launch the install, I call MsiSetInternalUI, with the setting NONE.
Then I call MsiSetExternalUI, registering my call back function with it.
Then I call MsiInstallProduct to do the install. The 2nd parameter to
MsiInstallProduct is the command line arguments. So you could have
something like:
ADDLOCAL=Feature1,Feature2,Feature6,Feature7 USERNAME="Joe" COMPANY="Joe
Inc." CDKEY="123-123"
And to do an uninstall, in the call to MsiInstallProduct, pass in
"REMOVE=ALL" as the second parameter.

At the end, you would want to close the handle created by the
MsiOpenDatabase. I did test this, and I was able to query the database
while the MsiInstallProduct was running.

Hope this helps, without making it more confusing. I think the only
difference from what you probably have and what I have is MsiOpenPackage vs
MsiOpenDatabase.

"Bill Henning" <ju...@at-actipro.software.com> wrote in message
news:%23op1t0B$FHA...@TK2MSFTNGP12.phx.gbl...

Richard [Microsoft Windows Installer MVP]

unread,
Dec 8, 2005, 8:39:56 PM12/8/05
to
[Please do not mail me a copy of your followup]

"Bill Henning" <ju...@at-actipro.software.com> spake the secret code
<#op1t0B$FHA...@TK2MSFTNGP12.phx.gbl> thusly:

>Hi there, I'm experimenting with using C# (.NET 1.0) Windows Forms as a
>custom external UI for an MSI package since all our end users will have .NET
>1.0 on their machines.

If you're not using it already, you probably want to look at my
interop library for MSI.
<http://sourceforge.net/project/showfiles.php?group_id=40188&package_id=110212>

The rub is that the only function I've yet to get working properly is
the one that sets the callback for the external UI :-(. If you have
that part working, please contribute the code back to me so that I can
integrate it into the interop library.

>I've got a Wizard based app started and I'm able to open the MSI using
>MsiOpenPackage. This of course lets me get property values and list
>features, etc. So that's all fine but then I get to the wizard step when I
>need to install the features.

Basically what you want to do is run the execute sequence. To do
that, execute the action "EXECUTE", all caps. This is the standard
action that processes the execute sequence.

>What is the best way to do this? The problem I have is that I tried API's
>like MsiInstallProduct or MsiConfigureProduct but those complain that the
>MSI is already running, probably because of my open package handle from
>MsiOpenPackage.

Yeah, you don't want to do those.

>Considering that I have an external UI, what is the best way to kick off the
>normal installation routines with an API while still keeping my package
>handle open? And also how do I indicate that I would want to uninstall
>features when in a maintenance mode?

When you do the EXECUTE action, then your message callback will get
invoked as the actions are run, progress bar updates happen, etc.

Let me know how it goes, I've considered doing a C# app for the GUI
for some time!
--
"The Direct3D Graphics Pipeline"-- code samples, sample chapter, FAQ:
<http://www.xmission.com/~legalize/book/>
Pilgrimage: Utah's annual demoparty
<http://pilgrimage.scene.org>

Richard [Microsoft Windows Installer MVP]

unread,
Dec 8, 2005, 8:41:14 PM12/8/05
to
[Please do not mail me a copy of your followup]

"Bill Henning" <ju...@at-actipro.software.com> spake the secret code
<#op1t0B$FHA...@TK2MSFTNGP12.phx.gbl> thusly:

>Hi there, I'm experimenting with using C# (.NET 1.0) Windows Forms as a


>custom external UI for an MSI package since all our end users will have .NET
>1.0 on their machines.

If you're not using it already, you probably want to look at my

The rub is that the only function I've yet to get working properly is
the one that sets the callback for the external UI :-(. If you have
that part working, please contribute the code back to me so that I can
integrate it into the interop library.

>I've got a Wizard based app started and I'm able to open the MSI using


>MsiOpenPackage. This of course lets me get property values and list
>features, etc. So that's all fine but then I get to the wizard step when I
>need to install the features.

Basically what you want to do is run the execute sequence. To do

that, execute the action "EXECUTE", all caps. This is the standard
action that processes the execute sequence.

>What is the best way to do this? The problem I have is that I tried API's


>like MsiInstallProduct or MsiConfigureProduct but those complain that the
>MSI is already running, probably because of my open package handle from
>MsiOpenPackage.

Yeah, you don't want to do those.

>Considering that I have an external UI, what is the best way to kick off the


>normal installation routines with an API while still keeping my package
>handle open? And also how do I indicate that I would want to uninstall
>features when in a maintenance mode?

When you do the EXECUTE action, then your message callback will get

mgama

unread,
Dec 8, 2005, 8:56:13 PM12/8/05
to
Richard, I'll take a look at your library, and see if I can find the missing
piece. Can you shoot me an email, so we can exchange questions/findings
that way? The email address which I post with is valid. Thx.


"Richard [Microsoft Windows Installer MVP]"
<legaliz...@mail.xmission.com> wrote in message
news:%23b$Y2FG$FHA...@TK2MSFTNGP12.phx.gbl...

Bill Henning

unread,
Dec 9, 2005, 12:14:13 PM12/9/05
to
Thanks for the info. I like using the other APIs so I was able to use them
until my actual progress wizard page where I close the package, run
MsiInstallProduct, and then reopen the package. That seems to work well.

And your tip for adding/removing worked perfect.

Oh and to reply to Richard, no I hadn't seen your interop library for MSI
before your posting. I had been using one that I found on the internet that
did a direct list of all the APIs and enums, so it's not nicely wrapped like
yours.

But you mentioned calling an EXECUTE action. I tried this but it returned
FunctionNotCalled:
MsiError result = MsiInterop.MsiDoAction(packageHandle, "EXECUTE");

Any idea what I did wrong there? It would sure be nice to not have to call
MsiInstallProduct and just call that instead. But in the event that I do
get EXECUTE working, how do you specify options like REMOVE=ALL?

I have a UI that is written in C# that has a few of the pages implemented
that I need (not all yet, and it's all still work in progress). The
progress page does show messages from the MSI and increments the progressbar
appropriately so that appears to be working so far. However I've only
tested it with a MSI containing a single file.

Bill

"mgama" <mgam...@hotmail.com> wrote in message
news:Ogdz77E$FHA....@TK2MSFTNGP09.phx.gbl...

Richard [Microsoft Windows Installer MVP]

unread,
Dec 9, 2005, 2:20:57 PM12/9/05
to
[Please do not mail me a copy of your followup]

"Bill Henning" <ju...@at-actipro.software.com> spake the secret code

<ukln5PO$FHA....@TK2MSFTNGP14.phx.gbl> thusly:

>But you mentioned calling an EXECUTE action.

Sorry, I had the name wrong. The action is called 'ExecuteAction';
see the docs for details on this action.

>[...] But in the event that I do

>get EXECUTE working, how do you specify options like REMOVE=ALL?

You're writing your own UI, so you're replacing all the functionality
in the InstallUISequence. That involves changing properties,
potentially changing the MSI database and changing the feature request
state. REMOVE=ALL can be done by simply setting the REMOVE property
and then invoking the ExecuteAction action.

sril...@gmail.com

unread,
Jun 28, 2016, 7:05:42 AM6/28/16
to
Hi all , are you able to open MSI wizard and get the changes of msi inputs and get it in code..is there way..i am really not able to open msi wizard from code and give inputs..
0 new messages