Link to home
Start Free TrialLog in
Avatar of perezthomson
perezthomson

asked on

microsoft visual c++ 6.0 correct way to remove items from resources

i would like to know the correct way to remove items from a form or a dialog.

I´ve been asigned to transform a visual 6 proyect and i wold like to know how to delete a hole group of buttons. What Ì´ve done is just hide them:
      GetDlgItem(IDC_STATIC1)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_LBL1)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_LBL8)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_LBL6)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_LBL7)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_STATIC_TURNO)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_EDIT_PLAYA)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_DTPICKER_FECHA)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_DTPICKER_HORA_DESDE)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_DTPICKER_HORA_HASTA)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_EDIT_TURNO)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_LBL3)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_COMBO_PEAJISTA)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_TIPO_VEHICULO)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_TIPO_VEHICULO2)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_COMBO_TIPO_VEHIC)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_STATIC_IMPORTE_TRANSITO)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_IMPORTE)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_GRID_LIGEROS)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_COMBO_ID_PEAJISTAS)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_LBL2)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_COMBO_VIA)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_BUTTON_GENERAR)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_STATIC2)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_GRID_RESULTADOS)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_GRID_TOTAL_RESULTADO)->ShowWindow(SW_HIDE);
      GetDlgItem(IDC_LOGO_CONCESIONARIA)->ShowWindow(SW_HIDE);

but now i cant redesign from the resource view because its full of these itmes, and if i delete them i get an error from the oninitialupdate MFC function.

Avatar of Gregdo
Gregdo
Flag of Canada image

If you want to actually delete these items, then remove any code that refers to them:

1. Delete all the GetDialogItem() function calls above and any other code that refers to the controls that you want to delete.
2. Using the resource editor, remove the controls that you no longer need.

Check that it still builds and works.

3. Clean up the Resource.h header (or other header containing all the #defines) by removing the definitions for all the controls that you deleted.  Be aware that sometimes the same #defines can be used for multiple resources, so even though you removed them from this dialog, the #define might still be needed by another.
ASKER CERTIFIED SOLUTION
Avatar of Gregdo
Gregdo
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial