/build/static/layout/Breadcrumb_cap_w.png

Hiding Cancel button in MSI using Visual Studio

Hi I am trying to add the following custom action in Visual Studio to hide the CANCEL button.

Function HideCancelButton()

Dim Record
Set Record = Installer.CreateRecord(2)

Record.IntegerData(1) = 2
Record.IntegerData(2) = 0

Session.Message msiMessageTypeCommonData, Record

' return success
HideCancelButton = 1
Exit Function

End Function
I've added the vbs into the project and vbs showed up under Install, Commit, Rollback, and Uninstall. When I run the MSI package, the Hiding doesn't happen until the very end of installation, meaning that during the initial setup it is still showing and the user can click on Cancel and abort installation.

I think i need to update the actual MSI in order change the order of the events that are executed, I tried that in the InstallExecuteSequence, I've made the Install action as the #1 sequence, yet it is still not the first thing that is executed. Can anyone help?

Thanks

0 Comments   [ + ] Show comments

Answers (18)

Posted by: emmy12 16 years ago
Senior Yellow Belt
0
Hi Alex,

There is a different ways to deal with this.

Method 1:
I presume the 'Cancel' button appears in progress dialog
Reduce the size of the dialog (say to 200) and the cancel button wont be visible to the user
However if you want to use other butons that exist along side the 'cancel' button then this method may not apply

Method 2:
Try using the following table
"Control" table.
However ensure that it does not affect any reference by other tables

Method 3:
Try using the following table
"ControlCondition" table.
Using this you may try to hide the 'cancel' button

PS: I havent tried the effectiveness of 2nd and 3rd method, so you may try it and post the result

Cheers
Emmy
Posted by: aleks1429 16 years ago
Orange Belt
0
I have deleted all dialog windows. The only dialog window that comes up is the Windows Installer window with one button the CANCEL button.

I know that there has to be a way to do this, I am able to get this functionality working with trial version of InstallShield. But client specifically wants VS.

Any thoughts?
Posted by: anonymous_9363 16 years ago
Red Belt
0
Wouldn't it be much simpler to change the UILevel property's value?

http://msdn.microsoft.com/en-us/library/aa369487.aspx

If you're running the MSI from a command line (as in "MSIExec /i [MSI_Name]...") you can use the '!' switch modifier.
Posted by: aleks1429 16 years ago
Orange Belt
0
I am not having problems running from the command line. Actually the code line below gives me exactly what I need. However, this package has to be double clicked, it is not an enterprise domain deployment where I could have used a batch script.

msiexec.exe /i packagename.msi /qb!

How can I use the Installer.UILevel Property? Is it something I need to modify with an editor?

Thanks
Posted by: anonymous_9363 16 years ago
Red Belt
0
You can set it as a property in the 'Properties' table. I supplied the link in case you were using the automation interface.
Posted by: aleks1429 16 years ago
Orange Belt
0
Do you mean that I should create property named msiUILevelNone and set the value to 2 for silent install?
Posted by: anonymous_9363 16 years ago
Red Belt
0
No, create a property named 'UILevel'. The 'msi' prefixed variables would be used if you were using the WindowsInstaller object interface.

Set the IULevel property's value to 3 (msiUILevelBasic) + 32 (msiUILevelHideCancel), therefore 35. Setting it to 34 (2 + 32) would mean you would see nothing, not even the progress dialog.
Posted by: aleks1429 16 years ago
Orange Belt
0
If I understood you correctly, I need to open the MSI and add a UILevel property in the Property table with value 35. Is that correct?

Does also mean that I don't need the Custom Action script?

Thanks
Posted by: aleks1429 16 years ago
Orange Belt
0
That didn't work....
I opened up the MSI and added UILevel property to the Property table with value 34 and then 35, neither worked. Any ideas what i can try next?
Posted by: AngelD 16 years ago
Red Belt
0
If I recall you cannot predefine the UILevel property as it will be set during MSI execution.
If you double-click the MSI then the UI sequence will be executed which requires you to add the CA into the InstallUISequence table for it to have any effect.
Posted by: aleks1429 16 years ago
Orange Belt
0
i just want to hide the Cancel button, it has to be possible in VS...I don't know how to make custom action be the first thing that gets executed, can someone help?

Thanks
Posted by: anonymous_9363 16 years ago
Red Belt
0
ORIGINAL: AngelD
If I recall you cannot predefine the UILevel property as it will be set during MSI execution.
I guess it could be done via a Type 51 CA, though? I guess it depends on where in the sequence the engine sets it by default. Schedule a 51 CA after that...?
Posted by: AngelD 16 years ago
Red Belt
0
Could be true Ian, would have to test my self.
Session.Installer.UILevel from a vbscript or calling the MsiSetInternalUI function in some way maybe.
Posted by: aleks1429 16 years ago
Orange Belt
0
Thank you guys. I actually got it to work.

I manually uploaded the script and created the correct entries in with Orca. VS for some reason wasn't good at storing script as a binary file during drag and drop, instead during deployment it was dropping it on the file system

I made the action of Type 6 and made the InstallExecuteSequence the first one. It worked for me.

Thank you guys!!!
Posted by: anonymous_9363 16 years ago
Red Belt
0
ORIGINAL: aleks1429
I made the action of Type 6 and made the InstallExecuteSequence the first one.
"...and then I paid for and downloaded a proper MSI authoring tool." :)
Posted by: Jamie B 16 years ago
Orange Senior Belt
0
What's wrong with Orca Ian?Clean edits every time as apposed to Wise!
Posted by: anonymous_9363 16 years ago
Red Belt
0
ORIGINAL: Jamie B
What's wrong with Orca Ian?Clean edits every time as apposed to Wise!
There's nothing wrong with Orca, JB, but the advantages of these tools far outweigh their disadvantages.
Posted by: AngelD 16 years ago
Red Belt
0
For anyone else reading this the msiMessageTypeCommonData constant is missing in the first post.

The function should look like:
Function HideCancelButton()
Const msiDoActionStatusSuccess = 1
Const msiMessageTypeCommonData = &H0B000000

Dim Record : Set Record = Installer.CreateRecord(2)
Record.IntegerData(1) = 2
Record.IntegerData(2) = 0

Call Session.Message(msiMessageTypeCommonData, Record)

HideCancelButton = msiDoActionStatusSuccess
End Function
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ