cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
gavin_landon
Level 6

Changing a control's property.

This is an EXE, not an MSI..

I've looked through help and I guess I'm just missing it. How do I change a control's property/attribute?

For example I have check boxes and radio buttons. I'm checking registry and if there is a specific value, I'm wanting to disable one of the check boxes and one of the radio buttons. I see they both have an enable properties, but I'm not finding how to change them on the fly.

I found SetProperty, but that doesn't seem to be a function so I'm unsure how to use it. Would have been nice if the third parm of CtrlSetState() was an INT instead of a BOOL so that it could handle more than just check state.
Labels (1)
0 Kudos
7 Replies
RobertDickau
Flexera Alumni

Right, CtrlSetState is just for selecting and clearing check boxes and radio buttons. To enable and disable a control, you can use EnableWindow (search these forums and the dialog source code); and to hide and show you can use ShowWindow.
0 Kudos
gavin_landon
Level 6

Searching through looking for EnableWindow I saw someone post about _WinSubEnableControl(). That seems to work nicely. Is there a difference between the two and is there are reason to use one over the other?

_WinSubEnableControl (hwndDlg, INSTALL_TYPE_CHECK_INSTALL_CONSOLE, 0);

I can't seem to get EnableWindow to work. I'm unable to find any example code so I know it's params, but I guessed based on ShowWindows it (HWND, 0/1). Doesn't error, but doesnt seem to do anything either.

Is there a version of _WinSubEnableControl for Show and Hide as well?
0 Kudos
gavin_landon
Level 6

I found how to use it..
hwndItem = GetDlgItem( hwndDlg, nControlID );

So, that seems a lot of extra steps. Seems to me that _WinSubEnableControl would be a better use, or is it?

I'm still searching for the Show Hide version of _WinSubEnableControl
0 Kudos
RobertDickau
Flexera Alumni

They're essentially the same. EnableWindow is the direct Windows API call, while the _WinSub version saves you the trouble of a separate call to GetDlgItem.

P.S. Winsub.rul suggests there's a _WinSubShowWindow function, but I haven't used it (I tend to use GetDlgItem and ShowWindow).
0 Kudos
gavin_landon
Level 6

Thanks.. _WinSubShowWindow() seems to be the same as ShowWindow(). I still have to call GetDlgItem() to use it.

hCtrl = GetDlgItem(hwndDlg, INSTALL_TYPE_CHECK_INSTALL_CONSOLE);
//_WinSubShowWindow(hCtrl, 0);
ShowWindow(hCtrl, 0);

Is there a list somewhere of all API's in InstallShield? If there were it would save a lot of time just searching for Enable and seing what comes up..

Kind of like VB6 and their TXT file with all the Windows API Declarations.. That would be awsome.
0 Kudos
RobertDickau
Flexera Alumni

The Winsub.h header file shows the handful of pre-prototyped generic Windows API functions.
0 Kudos
gavin_landon
Level 6

Only 19 IS function in there, but thats a good start. Exactly what I'm looking for.
0 Kudos