How to show/Hide Document controls??? - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

vicky
Posts: 66
Joined: Thu Aug 21, 2008 10:52 am

How to show/Hide Document controls???

Hi!

I am using AI-6.4 and building an enterprise project. In my .aip project there are some customized dialogs, I would like to show/ hide or enable/disable any of them programatically. Say, i've added a checkbox and want to show/hide through custom action which is in VC 6.0 DLL.
I've gone through some code at MSDN site
http://msdn.microsoft.com/en-us/library ... S.85).aspx

Code: Select all

UINT __stdcall HideCancelButton(MSIHANDLE hInstall)
{
	PMSIHANDLE hRecord = MsiCreateRecord(2);
	if ( !hRecord)
		return ERROR_INSTALL_FAILURE;

	if (ERROR_SUCCESS != MsiRecordSetInteger(hRecord, 1, 2)
	 || ERROR_SUCCESS != MsiRecordSetInteger(hRecord, 2, 0))
		return ERROR_INSTALL_FAILURE;

	MsiProcessMessage(hInstall, INSTALLMESSAGE_COMMONDATA, hRecord);

	return ERROR_SUCCESS;
}
But, in this code we know CANCEL button ID number i.e. 2. I don't have ID numbers for Check boxes, Edit boxes, buttons etc. of dialog or is there any way to get these numbers.
How could i achieve this? Plz give me some VC code to perform this task.


Regards,
Vicky
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: How to show/Hide Document controls???

Hi Vicky,

Please note that you can show or hide controls by using Control Conditions in the "Dialog Editor". These conditions can use properties set during the install process.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
vicky
Posts: 66
Joined: Thu Aug 21, 2008 10:52 am

Re: How to show/Hide Document controls???

Hi Cosmin!

I know that it can be done using "Control Conditions", but i want to do it programatically.

Regards,
Vicky
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: How to show/Hide Document controls???

Hi Vicky,

The recommended approach is this:
- use a custom action to determine if the control will be hidden or not
- based on the result, set a custom property inside the custom action
- use that property for a control condition

However, if you need to manage the controls completely from the custom action, you can try using windows functions:
- find the installer window
- find the control you want to manage
- show it or hide it

I'm afraid we do not have sample code for this.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”