Loading
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.

  • Community Manager (Flexera Software)

    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.
  • 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?
    Expand Post
  • 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
    Expand Post
  • Community Manager (Flexera Software)

    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).
  • 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.
    Expand Post
  • Community Manager (Flexera Software)

    The Winsub.h header file shows the handful of pre-prototyped generic Windows API functions.

Loading
Changing a control's property.