Can I insert a hidden control into Windows Installer?

Starting with what I need the final result: The client can paste the product key of the desired format from the clipboard into the input field during installation.

Where I am at the moment: We use WiX to create our MSI. We are currently using a masked editing editor that works great. Checking the product key is already performed using a special action when you click the "Next" button. Product key verification should remain unchanged, only input problem.

I spent the last day exploring the possible ways to achieve this and have some ideas, although I'm not sure if any of them will work. I already ruled out trying to trigger custom actions on insertion, because I know that MSI is not able to capture this event.

So, my thoughts are the paste from clipboard button. This will trigger a custom action that will allow you to grab the clipboard item, decide whether it will look like a product key (this will be the easy part), and then somehow paste it into the edit control. Notice how I can say that editing control, I’m not sure that this would be possible with a masked editing control, and I’m not sure that it would even work with a standard editing control. I already have a custom action that allows me to check whether the license text was viewed, and this is achieved by searching for the window and the window of the "richedit" class in which the license is located, and getting the scroll position. I thought this method could allow me to set the edit control in my buffer key, again, I'm not sure if this will work.

I already read about the possibility of writing your own user interface controller. I know that this is a big task, but nothing is ruled out at this stage, I just don’t know where to start.

My last idea, although I don’t have any thoughts on how it can be implemented, it would be possible to change my masked edit control to a standard edit control that will obviously allow you to insert the full product key, although without using a custom one to check that it is in the correct format, I still will not go any further. But this would require some automatic dash addition if the customer entered the product key manually.

Can someone shed light on the possibility of any of my ideas and how to implement them or any other ways to achieve my goal?

+4
source share
1 answer

I managed to do this using the "paste from clipboard" option that I was originally thinking about. I added a button to my form, which invokes a custom action that requests the clipboard, and, if successful, sets two properties in the installer. One containing a formatted product key and one basic property to determine if the clipboard operation was successful or not. Masked edit control is related to the property of the product key and updating the control,

<Publish Event="Reset" Value="0" Order="3">ClipboardSuccess = 1</Publish> 

The product key is populated with a hidden edit control.

+1
source

Source: https://habr.com/ru/post/1437584/


All Articles